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

September 24th, 2009

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.


  1. September 24th, 2009 at 21:44 | #1

    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.

  2. September 24th, 2009 at 22:21 | #2

    @Googleverse – care to explain how it effects performance. Curious. Thanks.

  3. September 24th, 2009 at 23:38 | #3

    Simple. Server has not to search for theme files inside large folder. Server utilization is reduced as it knows where to look.

  4. September 24th, 2009 at 23:40 | #4

    @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 …

  5. September 28th, 2009 at 17:59 | #5

    Thanks, saved me loads of time figuring what was wrong when trying to do an import

  6. October 2nd, 2009 at 10:30 | #6

    thanks! been cracking my brain on how to fix this. hehehe

  7. Shibu
    October 16th, 2009 at 09:40 | #7

    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?

  8. Jitendra
    October 19th, 2009 at 20:01 | #8

    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

  9. October 19th, 2009 at 23:23 | #9

    @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

  10. John
    October 20th, 2009 at 22:36 | #10

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

  11. October 21st, 2009 at 07:19 | #11

    Thanks, your tutorial for this code -> define(’UPLOADS’, ‘wp-content/new_folder’);

    very useful once again thanks from indonesia :)

  12. October 21st, 2009 at 08:39 | #12

    @Gilank – Welcome

  13. Rosaleen
    October 30th, 2009 at 03:13 | #13

    eeek..this hasnt worked for me. i’ve tried a few folders (wp-content/uploads, /wp-content/uploads, http://myaddress.com/wp-content/uploads, etc) but nothing…
    i had also tried changing the permissions on the folders and that didn’t work either. any other ideas?

  14. October 30th, 2009 at 17:20 | #14

    @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.

  15. November 3rd, 2009 at 04:53 | #15

    @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!

  16. November 3rd, 2009 at 09:41 | #16

    @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.

  17. November 3rd, 2009 at 20:23 | #17

    Thank you Gautam for the answer.
    Worked out. the folder had to be named “uploads” and not “Upload” as I did and the permissions where to be 777.
    Then for the importing I had to retry several times, untill all the images were imported.
    (http://myblog.files.wordpress.com/2009/09/dscn8364.jpg... Remote file error: Remote server did not respond)
    Thanks.

  18. Jeremie Wade
    November 5th, 2009 at 22:21 | #18

    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!

  19. November 7th, 2009 at 13:05 | #19

    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 ?

  20. zoubayda
    November 20th, 2009 at 00:55 | #20

    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“,

  21. November 20th, 2009 at 20:52 | #21

    @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.!

  22. November 23rd, 2009 at 00:58 | #22

    @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. :)

  23. January 2nd, 2010 at 21:07 | #23

    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?

  24. maria
    January 14th, 2010 at 10:35 | #24

    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?

  1. No trackbacks yet.