Today I moved one of my site to a new server and when I tried uploading an image I got this error :

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

The parent directory is 2009 and uploads is ‘super’ parent directory (if I can call it that way). Both the directories had 777 permission so there was nothing wrong with the permission settings.

The problem was not with the directory permissions, but it was with URL where WordPress was trying to upload the image.

On my previous server, I had the blog in a folder named ‘tech’ and in the new server I had renamed it as ‘technology’.

Since I had moved the complete blog to the new server, the upload path was pointing to :

/home/tech/public_html/wp-content/uploads/2009/09

instead of pointing to

/home/technology/public_html/wp-content/uploads/2009/09

Do you notice the source of the problem ?

How can you fix it ?

Simple,
Login to your Blog as admin, go to Miscellaneous under Settings.

You’ll find the option “Store uploads in this folder” Set it to default which is “wp-content/uploads“, unless u specifically want the content in some other folder.

This should solve your problem !

There is a more complicated way of changing the file upload path of your wordpress blog, this is recommended only for those who know how to handle wp-config file !

For this you’ll have to modify wp-config.php file. Add below mentioned code before

require_once(ABSPATH.’wp-settings.php’); code in your wp-config file

define(‘UPLOADS’, ‘wp-content/new_folder’);

Once you save this new configuration all your uploaded files will go to the ‘new_folder’ under wp-content directory.

69 COMMENTS

  1. @Merv

    Merv :
    Thanks for the tips. I moved my blog from one server to another and your tip fixed the problem. But the fix is located in settings > Media. not “Miscellaneous” in WP 3.1

    Thanks..really its help me..

  2. oh yes, that’s ironic – at least it didn’t strip the space after define which I think is still useful.
    I wonder if this will work?:
    define ('UPLOADS', 'wp-content/new_folder');

  3. define(‘UPLOADS’, ‘wp-content/new_folder’);
    did NOT work for me. Perhaps you can change this to

    define (‘UPLOADS’, ‘wp-content/new_folder’);
    (the difference is the single quote is an apostraphe!

  4. Merv :
    Thanks for the tips. I moved my blog from one server to another and your tip fixed the problem. But the fix is located in settings > Media. not “Miscellaneous” in WP 3.1

    Thanks for the new location

  5. Thanks for the tips. I moved my blog from one server to another and your tip fixed the problem. But the fix is located in settings > Media. not “Miscellaneous” in WP 3.1

  6. Thanks, it worked for me!!! I had that error when trying to load the /wp-admin page, so the only fix that worked was “the more complicated way”.
    Keep up the good work

  7. Hi, where can i find the wp-config.php? i face this Is “its parent directory writable by the server?”
    i’ve tried the 1st method but it does not work ><

  8. Thank you so much for this solution! I was banging my head against the wall trying to figure out why it was looking at the wrong directory when I was installing the plugin. You saved me hours of work :)

  9. @Les – May be what you suggest works, but doesn’t mean that this doesn’t work out. I’ve experienced this problem and this solution worked for me. It has helped a lot of others who’ve commented about the same.

  10. This was the worst advice possible. Just check your storage limits and see if you have exceeded them. This is probably the case! Don’t change your WP-CONFIG file – this will screw some shit up for sure!

  11. Thanks a bunch,

    This was driving me crazy, ultimately I had the same problem someone else did.

    I transferred my blog to a new hosting company. I had /wp-config..

    Same thing I should have only had wp-config without the slash when I made the change it worked.

  12. Thank you very much! I was desperate to solve this problem until see your site.Changing code is really useful for me. Thxxxxxxxxxxxxxxxxxxxxx

  13. Awesome! After lots of searching this worked. My host must have swapped the website from home/ to home2/ !!
    Cheers for the solution.

  14. For me I had to make sure the file was there. It was under wp-content/uploads and i didn’t have that file. I got rid of the /uploads and it worked!

  15. @andy – if there’s no content, then it surely will save your time if you install everything from fresh. Sounds like a better option at this point when you are not able to find the right solution.

  16. I guess i’m next to jump on the wagon. Working on my dad’s site and having this issue. I’ve double checked all spelling and punctuation. I’ve deleted folders and tried again, i’ve tried different names. I’ve made sure all permissions were set to 777 for every folder in the hierarchy of the blog (i’ve done this through Fillezilla and then even logged into his Plesk Control Panel, and checked in their file manager). I modified the wp-config.php file, which for some reason didn’t do anything. It didn’t change directories or anything. Not sure if stuff has changed since we just upgraded to WP3. Anymore ideas?? He doesn’t have any post, so should I just try killing everything and reinstalling?
    thanks for any help

  17. @Melissa – Glad it helped you. For a newbie, it becomes a mystery handling these things the first time. Next time around, you’ll surely solve your problems much quicker :)

  18. Thank you, thank you, thank you! I’m new to WordPress, CSS, and PHP and I could not figure out what was going on. Solved my problem right away. :)

  19. my problem when upload thumbnails is..
    The uploaded file could not be moved to /var/www/vhosts/webwisepreview.com/httpdocs/demosite/wordpress/wp-content/uploads.

    anyone can help?
    everything is 777

  20. I had this problem and spent several hours reading posts about with no luck. My permissions were right and the upload folder path was correct.

    I realised that it was a SELinux issue for me. If you run SELinux then you will need to run the command below to allow apache (httpd) to execute particular PHP commands, including creating new files and folders. Here is the command:

    chcon -R -t httpd_sys_content_t

    Hope that helps someone else. This was driving me crazy and I was about ready to give up and uninstall WordPress. Glad it didn’t come to that.

  21. geeeez! all the problem was that it should say “wp-content/uploads” and NOT “/wp-content/uploads”

    that off the “/” in the beginning. what a world of hurt because of that slash.

  22. Thanks! This saved me a lot of time and aggravation. I kept trying to change all variations of 777 permissions for my upload folders etc and was pulling my hair out. awesome post.

  23. I have the same problem…I changed the permissions to 777. I checked the path and its correct and I did the above and got the error:

    Warning: Division by zero in /Library/WebServer/Documents/wordpress/wp-config.php on line 77.

    Any more solutions?

  24. I have done all the tips above, but it still doesn’t work.
    And now , on top of it appear “Warning: Division by zero in /home/a4866193/public_html/wp-config.php on line 76”

    Have any other idea?

  25. @Jitendra
    @Zoubayda

    If messing with the wp-config.php still doesn’t do it, go to the Admin Dashboard, Settings, Miscellaneous, and delete the wp-content/uploads and untick organize by month/day. Save the changes.

    Then, add new post, insert image, go back to Miscellaneous. tick the organize by month/day. Save the changes. Hope it works. :)

  26. @Zoubayda – Have you checked the directory path – Most of the time it is the directory path that is not right, even a small spelling mistake can create this problem. If you are sure that the Directory path is correct, then please use the second method of over-writing your wp-config file and it will definitely solve your problem. Make sure you take a back up of wp-config file before you edit it, you’ll need it just in case some thing goes wrong.

    If you still have problem, please do get back and lets see what can be done. According to me there should be no problem.

    Cheers.!

  27. please i need help
    i am facing problem …that i can’t upload small imagine or video om my wordpress blog i am receiving this error:
    for upload image error is
    Unable to create directory /var/www/vhosts/zoubaydasoudi.com/httpdocs/wp-content/uploads/2009/11. Is its parent directory writable by the server?
    i have check the L Miscellaneous under Settings.
    You “Store uploads in this folder” Set it to default which is “wp-content/uploads“,

  28. Which version of WP are u using Jeremie ? strange that you encounter a problem when u try to link an image ! never face such an issue… may be it’s temporary .. may be the WordPress installation files are corrupt for some reason .. May be taking a back-up of the database and re-installing wordpress fresh might help. Not really sure what the problem is !… Can you tell me when was the first time you experience this problem ? Did you move your blog to a new server and since then experiencing this problem ?

  29. I’ve tried all the tips list above and nothing works for me.

    I can’t upload photos and when I’m navigating the Add Image pop-up (where you can either upload, use an outside link, or go to your media library) to add an image from the media library it gives me a 404-ish OOPS! Page Not Found.

    I’ve double checked the default folders and permissions and nothing seems to be working. HELP!

  30. @Jonas – I think the problem is with the URL. Have u tried following all the steps mentioned in the post ? I had a similar problem, and realized that the directory was pointing to old structure and not the new one. Once I changed the path to the correct, current directory everything worked fine. I suggest, you must try playing around with the directory path and that should solve your problem, or best is to follow the steps mentioned in the post, it should solve your problem. If the problem still persists, let me know and we can dig deep and see what the actual problem is.

  31. @Rosaleen,Gautam – Same problem here. I started WP new on my server and wanted to import my wordpress.com blog. However it keeps telling me:
    “Unable to create directory /home/httpd/vhosts/blog.jonas/httpdocs/wp-content/uploads/2009/11. Is its parent directory writable by the server?”
    Any ideas? – Thank you!

  32. @Rosaleen – Is your blog on the main domain or subdomain or any other sub-folder ? The above options should work, if nothing works, modifying the wp-config file should definitely work. Let me know if the problem still persists, we can do a remote session and figure the problem out.

    Cheers.

  33. Thanks for the post. This worked perfectly for me. DreamHost switched servers on me but the root directory didn’t get changed properly.

  34. @Jitendra – If you use the first method, then you don’t need to tamper wp-config.php. Try using the first option and if you still continue to face problems, then try the second method listed. If you have issues with either, please get back !

    Thanks

  35. PHP Error Message

    Warning: Division by zero in /home/xxxxxxx/public_html/wp-config.php on line 81

    line 81

    define(’UPLOADS’, ‘wp-content/uploads’);

    help please

  36. Hi Gautam,
    Thanks for the tip,by the way what if I am storing my images in another folder say img.domainname.com?

    Posting images in above said folder is working fine with WLW but not with WP.Any clues?

  37. @Googleverse – But server looks for files based on absolute or relative path. Under what circumstance would it look / search for files ? An example would be …

  38. One tip . I would like to give is that make some CUSTOM folders inside uploads folder. And in that custom folder you can keep really large files, big theme images and other things. Now after some time when your upload folder becomes considerably large (in 4-5 years), the number of items wont affect the performance.

LEAVE A REPLY