Wordpress Error: Unable to create directory / Is its parent directory writable by the server?

If you get this error when you try to upload an image to your WordPress blog, there are two things you can do:

  1. Go to Settings > Miscellaneous in your Wordpress admin area and make sure that ‘Store uploads in this folder’ is set to the default: wp-content/uploads (notice there is no ‘/’ before wp-content/uploads).  Try to upload again and see if it works.
  2. If that didn’t work, open up a terminal and navigate to the wp-content directory.  If wp-content does not contain sub-directory called ‘uploads’, create one and then change its permissions to wide open (sudo chmod 777 uploads/). Try to upload the image again.  If this works, navigate to the wp-content/uploads/ directory and check the owner of the image you just uploaded (ls -l). It will probably be something weird you’ve never seen before (mine was ‘www-data’). Navigate up a directory and change the owner of the uploads folder to the one WordPress want to use: sudo chown www-data:www:data. Then revert the permissions back to something a little safer: sudo chmod 755 uploads/ and you’re done.
This entry was posted in Musings. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>