Dear, friends.

I am using WordPress on Ubuntu 18.04 via DigitalOcean Apps Marketplace. PHP7.4 + Apache2 .

While tried to upload an image via WordPress media library, i have an error : “The uploaded file could not be moved to wp-content/uploads/2020/05

I have browse to some links and i tried this :

[https://devanswers.co/wordpress-upload-problem-uploaded-file-not-moved-to-wp-content-uploads/]

i typed ls -ld /var/www/html/wp-content/uploads/

And the result is drwxr-xr-x 5 www-data www-data 4096 Feb 11 04:13 /var/www/html/wp-content/uploads/

I need your help to fix this issue. Thank you.

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.

×
1 answer

Hi @Technosatmedia,

This error is usually generated to invalid ownership or permissions. Most probably it’s permissions. To fix that, I’ll recommend running the following commands

find /path/to/website/wp-content -type f -exec chmod 644 {} \;

The above command will change every file’s permission to 644 which are the default. The next command will do the same for folders but with 755 permissions

find /path/to/website/wp-content -type d -exec chmod 755 {} \;

Lastly, to fix the ownership, run the following command in your droplet

chown -R www-data:www-data /path/to/website/wp-content

You should be able to upload files now without a problem.

Regards,
KDSys

Submit an Answer