Jump to content

Can't Create Folder Upload And A File In The Folder


hunglduc
 Share

Recommended Posts

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

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

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 51
The 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...