File Upload Error

I was using sharing hosting and using verot to upload images. It was working fine. Then I moved my files to DO droplet, and it gives the error Destination directory can't be made writeable. Can't carry on a process.

I tried to add tmp file in php.ini but still doesn’t work. And chmod 777 didn’t work.

Do you have any idea to fix it? Thanks

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I solved the problem. It’s about the folder permission. If anyone gets this error, use this command chcon -R --type httpd_sys_rw_content_t /path/to/your/directory

And then make sure that your folder permission is 0755

Thanks for the answer Bobby! I am not using any kind of cms. I checked my apache error logs but I couldn’t find any clue about this error.

But when I upload the image, php error message is like

Warning: move_uploaded_file(ykln/1_EuMoSuvQHcKMgfji2H5Ssg.jpeg): failed to open stream: Permission denied in /var/www/html/beta/dsykl.php on line 14

Warning: move_uploaded_file(): Unable to move '/tmp/phpMMFUUW' to 'ykln/1_EuMoSuvQHcKMgfji2H5Ssg.jpeg' in /var/www/html/beta/dsykl.php on line 14

Hi there @dtorgul,

Are you using a CMS like WordPress? If so, I’ve seen this problem after migration to a new server, you need to make sure that you update your WordPress upload path so that it matches the new path on your server.

To change that you need to adjust the value at Settings> Media> Set Full URL Paths to files.

If you are not using WordPress, I would recommend checking your PHP and Apache error logs for more information on the exact error.

Let me know how it goes! Regards, Bobby