The Uploaded File Could not be Moved to wp-content

By | October 13, 2015

Symptom:

When attempting to add media to a WordPress post, the image is rejected and the following error message appears:

Wordpress Error

Cause:

The WordPress uploads directory (typically located at /var/www/html/wordpress/wp-content/uploads) on the web server does not have write permission enabled and/or the web user (likely www-data) is not a member of the group which the uploads directory belongs to.

Solution:

Give the group which owns the uploads directory write access

sudo chmod -R g+w /var/www/html/wordpress/wp-content/uploads

The -R option will add group write access recursively to all the subdirectories and files beneath the uploads directory.

Add the apache group (www-data on Debian) to the group which owns the uploads directory

sudo adduser www-data groupname

Troubleshooting Steps:

  1. Check the apache logs for error messages:
    • /var/log/apache2/access.log
    • /var/log/apache2/error.log
  2. Try adding www-data to the group which owns the uploads directory
  3. Change the permissions of the upload directory recursively to allow group write access to all subdirectories and files

Leave a Reply

Your email address will not be published. Required fields are marked *

*