WordPress: Unable to create directory wp-content/uploads/. Is its parent directory writable by the server?

Last updated on

If you see one of the following errors relating to the uploads folder:

  1. Unable to create directory wp-content/uploads/. Is its parent directory writable by the server?
  2. The uploaded file could not be moved to wp-content/uploads/

This may indicate a permissions problem with your WordPress uploads directory.

If you don’t have shell access to your web server to set up directory permissions, you may need to contact your web host for support.

If you have shell access, check the permissions for the directory WordPress is attempting to write to. You will need to locate your document root, in this example, our document root is /var/www/html and the WordPress uploads directory is in /var/www/html/wp-content/uploads/. If the uploads folder does not exist, create it.

Let’s check the permission for the uploads directory.

ls -ld /var/www/html/wp-content/uploads/
drwxr-xr-x 5 john john 4096 Feb 11 04:13 /var/www/html/wp-content/uploads/

Above we can see the owner of the directory is john, the person who set up the web server.

We need to change this to www-data. This is the user that owns the Apache/Nginx web server service and will give WordPress the necessary permissions to upload files.

Let’s recursively change the owner for our WordPress uploads directory and sub directories to www-data. Be sure to change /var/www/html/wp-content/uploads to your own uploads directory.

sudo chown -R www-data:www-data /var/www/html/wp-content/uploads

Now if we check the permissions for the uploads directory again, we should see www-data as owner.

ls -ld /var/www/html/wp-content/uploads/
drwxr-xr-x 5 www-data www-data 4096 Feb 11 04:13 /var/www/html/wp-content/uploads/

You should now be able to upload files again in WordPress.

1 Star2 Stars3 Stars4 Stars5 Stars 5.00 (3 votes)

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

p.s. I increased my AdSense revenue by 68% using AI 🤖. Read my Ezoic review to find out how.

2 replies

avatar
  Subscribe  
newest oldest
Notify of
NadVS
Guest
NadVS
NadVS
1 year ago

Hello, I wanted to make this command sudo, but it’s not recognized. And I don’t have root access because I am on a shared hosting. What should I do in this situation? Thank you