0
votes

I want to upload an image. Every time I try to upload the image I recieve the error message found below.

I have already set the permissions to read&write:

Warning: move_uploaded_file(uploads/1000020170620022532img3.png): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/social-network-master/profile.php on line 41

Warning: move_uploaded_file(): Unable to move '/Applications/XAMPP/xamppfiles/temp/phpYqSkvp' to 'uploads/1000020170620022532img3.png' in /Applications/XAMPP/xamppfiles/htdocs/social-network-master/profile.php on line 41

3
Probably something wrong with paths or permissions. if you set permissions correctly check the paths. Maybe change them to absolute paths temporary.modsfabio
welcome to SO, please consider the following: How do I ask a good question?hassan

3 Answers

1
votes

Friend, You only need only to create the directory where are your .php file is found:

uploads/

And change the Only write in the folder

0
votes

Please use below code:

move_uploaded_file($_FILES['image']['tmp_name'],'uploads/1000020170620022532img3.png');

If this code is not working please check path and folder permission.

0
votes

try this in terminal

sudo chmod -R 777 upload/

p.s. got to the upload directory and run sudo chmode -R 777 directly.