hunglduc Posted March 20, 2009 Share Posted March 20, 2009 why i run these code successfully, but it have not created folder upload, and a file with fillename in the folder if(file_exists("upload/".$_FILES["filename"]["name"])) { echo "File is already<br />"; } else { move_uploaded_file($_FILES["filename"]["tmp_name"],"upload/".$_FILES["filename"]["name"]); echo "File "."upload/".$_FILES["filename"]["name"]."<br />"; } Link to comment Share on other sites More sharing options...
ProblemHelpPlease Posted March 20, 2009 Share Posted March 20, 2009 make sure you have created the upload folder on your server before running the script Link to comment Share on other sites More sharing options...
hunglduc Posted March 20, 2009 Author Share Posted March 20, 2009 make sure you have created the upload folder on your server before running the scripti have created folder upload but i have not created a file in upload folder Link to comment Share on other sites More sharing options...
hunglduc Posted March 20, 2009 Author Share Posted March 20, 2009 it gave error message when i used these code. i have created a folder upload in the same directory the php file if(file_exists("upload/".$_FILES["filename"]["name"])) { echo "File already<br />"; } else { move_uploaded_file($_FILES["filename"]["tmp_name"],"upload/".$_FILES["filename"]["name"]); echo "File "."upload/".$_FILES["filename"]["name"]."<br />"; } Warning: move_uploaded_file(upload/fiche_tnvid041.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /opt/lampp/htdocs/upload_file.php on line 51Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpSrng0I' to 'upload/fiche_tnvid041.jpg' in /opt/lampp/htdocs/upload_file.php on line 51File upload/fiche_tnvid041.jpg Link to comment Share on other sites More sharing options...
justsomeguy Posted March 20, 2009 Share Posted March 20, 2009 Warning: move_uploaded_file(upload/fiche_tnvid041.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /opt/lampp/htdocs/upload_file.php on line 51The folder you're trying to move files to doesn't have the right permissions on it to allow you to do that. Link to comment Share on other sites More sharing options...
hunglduc Posted March 21, 2009 Author Share Posted March 21, 2009 The folder you're trying to move files to doesn't have the right permissions on it to allow you to do that.i have tried upload these code in free host to test, it run no errors but i didn't see the folder upload Link to comment Share on other sites More sharing options...
justsomeguy Posted March 23, 2009 Share Posted March 23, 2009 Are error messages enabled? Are permissions set correctly? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.