Dryan Posted December 31, 2009 Share Posted December 31, 2009 I added error_reporting(E_ALL); to the top of my .php file, and now it's returning this error: Warning: move_uploaded_file(/upload/tuffy-20071106.zip) [function.move-uploaded-file]: failed to open stream: No such file or directory in /homepages/28/d93538065/htdocs/library2/upload_file.php on line 24 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpw9MELL' to '/upload/tuffy-20071106.zip' in /homepages/28/d93538065/htdocs/library2/upload_file.php on line 24 Stored in: upload/tuffy-20071106.zip Here's my php code: <?php error_reporting(E_ALL); if (($_FILES["file"]["type"] == "application/zip") && ($_FILES["file"]["size"] < 10000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } Link to comment https://forums.phpfreaks.com/topic/186813-what-does-this-error-mean/ Share on other sites More sharing options...
wildteen88 Posted December 31, 2009 Share Posted December 31, 2009 Change this if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); to $upload_path = dirname(__FILE__) . '/upload/'; if (file_exists($upload_path . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], $upload_path . $_FILES["file"]["name"]); Link to comment https://forums.phpfreaks.com/topic/186813-what-does-this-error-mean/#findComment-986510 Share on other sites More sharing options...
Dryan Posted December 31, 2009 Author Share Posted December 31, 2009 I get this error when I try that: Warning: move_uploaded_file(/homepages/28/d93538065/htdocs/library2/upload/tuffy-20071106.zip) [function.move-uploaded-file]: failed to open stream: No such file or directory in /homepages/28/d93538065/htdocs/library2/upload_file.php on line 24 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phptmLl8g' to '/homepages/28/d93538065/htdocs/library2/upload/tuffy-20071106.zip' in /homepages/28/d93538065/htdocs/library2/upload_file.php on line 24 Stored in: upload/tuffy-20071106.zip Link to comment https://forums.phpfreaks.com/topic/186813-what-does-this-error-mean/#findComment-986512 Share on other sites More sharing options...
Dryan Posted December 31, 2009 Author Share Posted December 31, 2009 I uploaded the form and .php file to the root directory and it's working now. Link to comment https://forums.phpfreaks.com/topic/186813-what-does-this-error-mean/#findComment-986536 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.