When attempting to add media to a WordPress post, the image is rejected and the following error message appears:
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.
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
- Check the apache logs for error messages:
- Try adding www-data to the group which owns the uploads directory
- Change the permissions of the upload directory recursively to allow group write access to all subdirectories and files