Note that there are some explanatory texts on larger screens.

plurals
  1. POmove_uploaded_file() returning false
    text
    copied!<p>I have been uploading a file for last few hours. But always stuck at this point.</p> <p><em><strong>here is my controller function for upload</em>:</strong></p> <pre><code>function upload() { echo $targetPath = site_url('/uploads'); echo "&lt;br /&gt;"; $allowedExts = array("gif", "jpeg", "jpg", "png"); $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); echo $_FILES["file"]["type"]; if (!(($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "image/png"))) { echo "Return Code: " . $_FILES["file"]["error"] . "&lt;br&gt;"; } else { echo "Upload: " . $_FILES["file"]["name"] . "&lt;br&gt;"; echo "Type: " . $_FILES["file"]["type"] . "&lt;br&gt;"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB&lt;br&gt;"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "&lt;br&gt;"; if (file_exists($targetPath.'/'.$_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { if(move_uploaded_file($_FILES["file"]["tmp_name"],$targetPath.'/'. $_FILES["file"]["name"])) { echo "Stored in: " .$targetPath.'/' . $_FILES["file"]["name"]; } else { echo "not uploaded"; } } } </code></pre> <p><em><strong>and here is the output :</em></strong></p> <pre><code>http://localhost/sites/public_html/site/uploads image/jpegUpload: 1468716_668135866543165_1899878158_n.jpg Type: image/jpeg Size: 57.09375 kB Temp file: C:\wamp\tmp\phpC390.tmp not uploaded </code></pre> <p>Everything is going fine.</p> <p><strong>But its just not UPLOADING at desired location. What could be wrong ?</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload