Fixing error “Unable to create directory” or “The uploaded file could not be moved to” in WordPress

Someone I know was having issued with their WordPress installation. Since I’ve been using WordPress for ages (about ten days), I figured I’d have a look. Plus, I was the only one that he knew with technical experience. And his blog URL was printed in a periodical that was due to be shipped in two weeks, so expectations were running a little high. Sweet.

Every time an image was uploaded the following error was encountered:

Unable to create directory
/var/www/vhosts/domain.com/httpdocs/blog/wp-content/uploads.
Is its parent directory writable by the server?

I manually created the directory, and received a new error:

“The uploaded file could not be moved to /var/www/vhosts/domain.com/httpdocs/blog/wp-content/uploads”

After some sleuthing, it seemed to be an issue with PHP Safe Mode being enabled for the entire domain. There is a lot of differing opinions on how to address turning safe_mode off or even if you can turn it off for individual directories or not.

I’ll spare you the details, but let’s just say I got an unexpected self-taught crash course in PHP. After spending all morning on the issue, I ended up having the web host turn it off for the entire domain (something only they could do on the backend). The problem still persisted.

I came upon the answer after I changed the keywords I was using in Google. It’s so simple, I almost didn’t post it here. However, I am the Nubby Admin so it’s not like anyone has high expectations for me.

Solution:

First create the wp-uploads folder in the wp-content folder. Then change the permissions on wp-uploads to 777. I’m sure there are other possibilities, but that seemed to be the most straight-forward way.

Facepalm

Hopefully the search engines will smile on this post and save someone a morning of phpinfo() and ini_set().

3 Comments

  1. SBL

    October 29, 2011 at 8:02 am

    Thank you so much! >_<

    Reply

  2. pawan

    March 7, 2013 at 2:55 am

    Just edit your vsftpd.com
    remove tag from #write_enable=YES
    write_enable=YES
    restart vsftpd
    -/etc/init.d/vsftpd restart
    & you r done..:)

    Reply

  3. TW

    May 20, 2013 at 7:59 pm

    Thanks for your help, worked perfectly! (had to set 777 to apply to sub-directories as well)

    Reply

Leave a Reply

Follow TheNubbyAdmin!

follow us in feedly

Raw RSS Feed:

Contact Me!

Want to hire me as a consultant? Have a job you think I might be interested in? Drop me a line:

Contact Me!

Subscribe via Email

Your email address is handled by Google FeedBurner and never spammed!

The Nubby Archives

Circle Me on Google+!

Photos from Flickr

Me on StackExchange

The IT Crowd Strava Group

%d bloggers like this: