Search code examples
phpfile-uploadpermissionsfile-permissionspermission-denied

move_uploaded_file gives: failed to open stream: Permission denied


I am working with two different servers, and uploading files between them. From one to another. But that is not working. It worked when both are on my localhost, but when I want to upload file from my localhost onto another server that is a cloud server. It is giving me this error:

Warning:  move_uploaded_file(/var/www/data/user-blue.png): failed to open stream: 

Permission denied in /var/www/upload.php on line 67



Warning:  move_uploaded_file(): Unable to move '/tmp/phpVBiLvB' to '/var/www/data/user-blue.png' in /var/www/upload.php on line 67

How do I fix permissions on the cloud server? I have full root access if it is needed.


Solution

  • chmod on your directory to read write execute. Or give user permissions to te directory.