John
John

Reputation: 1

move_uploaded_file failed to open stream: Permission denied Mac

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

Upvotes: 0

Views: 2679

Answers (3)

Manthan Kyada
Manthan Kyada

Reputation: 1

try this in terminal

sudo chmod -R 777 upload/

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

Upvotes: 0

Cesar Velasquez
Cesar Velasquez

Reputation: 11

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

Upvotes: 1

Avinash Kumar Singh
Avinash Kumar Singh

Reputation: 117

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.

Upvotes: 0

Related Questions