WordPress.org

Ready to get started?Download WordPress

Forums

Error saving media attachment (29 posts)

  1. grianach
    Member
    Posted 4 years ago #

    Fresh install of 2.8.1 for a new site and I keep getting

    Error saving media attachment.

    when I try to upload a media file. My wp-content/uploads exists, has been chmod 777 -R and "Store uploads in this folder" is set to wp-content/uploads in the miscellanous settings. Plugins have been turned on and off, different directory tried but still not working.

    I've tried the suggestions on the Image/Media Uploader problems? post but that doesn't resolve it. Am I missing something obvious here?

  2. slr
    Member
    Posted 4 years ago #

    I'm having the same problem grianach.
    I did the same things that you did in creating the folder and changing the permissions.
    I also just tried uploading images into the folder via FTP, but the WordPress system didn't recognize them either.
    The upshot is that I can't access images in any way for my new WP installation.
    What did I miss?

    (PS- in another WP installation upgraded to 2.8.1 I have no problem with images)

  3. slr
    Member
    Posted 4 years ago #

    I solved this problem by deleting and re-creating my uploads folder.

    I also walked away for 24 hours...maybe a caching issue?

    Don't know why it worked but it did.

  4. felipex26
    Member
    Posted 4 years ago #

    Hi, I´m having the same problem...

    Any new?

  5. felipex26
    Member
    Posted 4 years ago #

    I resolved This Problem, first i created the uploads folder and has been permision 777 all directory.

  6. lauras_2009
    Member
    Posted 4 years ago #

    Same problem here. In my case I had changed the site url, and the upload seems to be looking in the old place. I restarted Apache and MySQL server, but that didn't help.

    I suppose I could just try putting the files in the old place, maybe that would help ... bogus hack though.

  7. lauras_2009
    Member
    Posted 4 years ago #

    I think I got it working -- if I try to add media from the left column of the admin, it doesn't work, it's looking for the wrong directory. (Use the Flash Uploader rather than the Browser Uploader ... it tells you specifically where it tried to create a directory to put the file).

    However, if I use the WYSIWYG editor and click on the little "Upload/Insert --> Add an Image" icon at the top of the text entry box, then WP can find and upload the image. You are not done however ... You must now put the image in a directory *outside* of your theme directory: in wp-content/uploads/<year>/<month>/ and WP will be able to find and display that image.

    I don't know if this will work for the long term since it's such a hack, but it's working for me at the moment.

  8. martinbean
    Member
    Posted 4 years ago #

    I'm having the same difficulties, but with the Flash uploader the only message I get is the extremely helpful "HTTP error".

  9. Jay Collier
    Member
    Posted 4 years ago #

    I've experienced several different issues related to this thread, most now resolved.

    - The Upload directory is often defaulted to root or nobody permissions so that all assets are managed by WordPress, rather than uploaded or downloaded via FTP. That allows WP to keep metadata in sync with assets. Through FTP you will be disallowed from making changes to permissions. A root administrator needs to make the changes.

    - The Flash uploader "HTTP error" is a different problem, related to Flash itself. Search the forums for several other threads on this.

    - After all that, I'm still seeing "Error saving media attachment" but only with large files. We added this to the htaccess file with no change.

    <IfModule mod_php5.c>
    php_value post_max_size 50M
    </IfModule>

    Are there other places where upload size is set?

  10. edmin
    Member
    Posted 4 years ago #

    Hi all,

    I have found that simply leaving a leading slash '/' on your upload URL will cause this problem.

    Settings > Miscellaneous > Store uploads in this folder

    Make sure this is set to:

    wp-content/uploads

    and not

    /wp-content/uploads

    Hope that helps someone!

  11. CopperBot
    Member
    Posted 4 years ago #

    edmin, you are a champion! Thank you so much!

  12. nostradamuszen
    Member
    Posted 4 years ago #

    Same problem here - none of the above hacks worked for me. Using a fresh install of WordPress 2.8.5.

    Isn't this a MAJOR BUG in WordPress?

    I tried setting permissions on all directories to 777, but still no luck.

    Hang on . . . I set permissions on wp-content to 777

    Then, I uploaded my images via Dreamweaver to uploads/2009/11 . . .

    Still no content when I went to the Library though.

    But, then, I found I *could* upload an image via the flash uploader.

    How bizarre is that???!!!

    It's a hack, Jim, but not as we know it!

    Cheers, Mark

  13. nostradamuszen
    Member
    Posted 4 years ago #

    OK, even more confused - it seems to work now without FTPing the images beforehand - maybe it is just a caching issue?

    (Or maybe setting wp-content to 777 sorted it - will we ever know?)

  14. Devin Walker
    Member
    Posted 4 years ago #

    I wrote an article that may help some of those with wordpress uploading files to the wrong directory: Please check it out here!

    Basically it says go to Settings > Miscellaneous > Upload media to directory... like Edmin's post says.

    Hope this helps!

  15. peterhudec
    Member
    Posted 4 years ago #

    I had the same problem, nothing helped. After an hour of confusion i called my hosting provider.
    They said it was because of some security mode, that PHP could not write files to server. They changed the settings and it works now like a charm.
    Hope, this was helpful for you

  16. edzrie_s
    Member
    Posted 4 years ago #

    same problem as above.i delete the database and create a new one.simply do it again from the start.works fine :)

  17. zerogmedia
    Member
    Posted 4 years ago #

    I had a similar issue when I migrated a wp site from one server to another. Everything seemed to work fine but I couldn't upload files to the media library.

    As has already been mentioned in this thread the issue is the file permissions and ownership settings of the uploads & wp-content directories on the server.

    If you have ssh access to the server you should be able to sort this out. I didn't have any luck deleting and recreating the uploads folder using ftp.

    I've come across this issue before so decided to do a little more research. I've made some progress in changing file permissions (chmod) but I don't have root access so I'm unable to change ownership (chown). But the issue has been solved by changing the uploads and wp-content directories to 775.

    I found this rather handy little tutorial on chmod which is the unix command to change file permissions.

    This page also explains how 777 and 775 are derived as I didn't know what they meant either. Hope this clears the air a little for the other web designers out there wrestling with server issues.

  18. jim.hubbard
    Member
    Posted 4 years ago #

    For IIS6 on Windows Server 2003 the issue may be a little different....

    To make sure that your permissions are right, right click on your "..\wp-content\uploads" directory, click "Sharing and Security" then click the "Security" tab. Here, select your "Internet Guest Account" and make sure that it has FULL permissions on this folder.

    Then, in WordPress' Admin dashboard, click on "Settings > Miscellaneous" and set "Store uploads in this folder" to "\wp-content\uploads". The first slash ("\") is definitely needed on 2003 Server - whereas it may not be needed on Apache.

    Good luck - I hope this helps...

  19. sarahmackenzie
    Member
    Posted 4 years ago #

    wow, well, at least I'm not alone in this...

    Just changed hosts for a client's blog and am unable to upload media via the Flash or Browser modes. I'm getting the:

    "Error saving media attachment"

    with the Browser mode and the Flash mode says:

    "Unable to create directory D:\Hosting\5300379\html/wp-content/uploads/2010/02. Is its parent directory writable by the server?"

    I'm completely unfamiliar with chmod and permissions but I did try changing the 666 to 777 in the editor. No dice.

    One thing that does work for me, though, is manually entering the URL of the image. Although, that is a temp fix as we need to get this issue SOLVED. Manually entering the url will allow the image to appear in the posts, but the post images are not feeding through to the home page. That's probably something else entirely...

  20. seraulu1
    Member
    Posted 4 years ago #

    Hi,
    thanks for that helpful suggestion

  21. timfl
    Member
    Posted 4 years ago #

    edmin's solution worked for me - that was almost too easy.

  22. fzo
    Member
    Posted 3 years ago #

    I Fixed the issue by Chrome-ing my uploads directory to 777 and then going to miscellaneous options in settings and UN-CHECKING the option that says "Organize my uploads into month- and year-based folders" Save Changes and thats it.

  23. stelil73
    Member
    Posted 3 years ago #

    I tried everything and no joy until the last post by fzo and bingo! Thanks!

  24. mtPockets
    Member
    Posted 3 years ago #

    This bug hit me today out of the blue. The post by fzo fixed it. The images where already 644 (the default I think) and the upload dirs are 777 on my host. All I had to do was un-check "Organize my uploads into month- and year-based folders".

  25. MadBuldog
    Member
    Posted 3 years ago #

    A Shoot out to fzo: You rule man, this fix is da bomb. :)

    It finally worked.

  26. draco2k
    Member
    Posted 3 years ago #

    If you are still having problems after trying all the great suggestions here, then selinux might be getting in your way if you are running it.

    For a quick test:

    1. turn selinux off (as root: setenforce 0)
    2. try to save your file
    3. turn selinux back on (as root: setenforce 1)

    If you were able to save your file, then the selinux context on your uploads directory is wrong.

    To correct (as root):

    1. cd to the parent folder of the uploads directory
    2. use the chown -R <uname>: uploads command to ensure that the uploads directory and all sub-directories are owned by the uid of the webserver (e.g. chown -R apache: uploads)
    3. use the command restorecon -R uploads to ensure that the uploads directory and any sub-directories have the correct selinux security context

    After this you should be able to save your images.

    I hope this helps!

  27. dcmoreni
    Member
    Posted 3 years ago #

    Hi all,

    I have the same problem, in my case it was my server service provider that only let my upload in a folther name "public" then wp cant use the folther "uploads".

    I solved redirecting my upload folder in Settings > Miscellaneous > Store uploads in this folder to "public/uploads" the true 777 folder in my site.

    sorry my english

  28. sablake
    Member
    Posted 3 years ago #

    I had the same problem...using the basic uploader I got the error:

    Error saving media attachment.

    Using the flash uploader, I got an error about file permissions on the server.

    I tried deleting the uploads folder, changing permissions to 777, 755 etc etc. But nothing helped

    My fix: I unchecked the "Organize my uploads into month- and year-based folders" checkbox in /wp-admin/options-misc.php and that seems to work.

  29. amajorov
    Member
    Posted 3 years ago #

    I found I didn't have a wp-content/uploads folder so I created one and set up permissions and ownership. Looks like I'm good now.

    If you're a Linux noob what I did was navigate to the wp-content directory and created the /uploads directory with:

    sudo mkdir uploads
    sudo chown root:www-data uploads
    sudo chmod 755 uploads

    So that's a make-directory, a change ownership and change of access mode, i.e. read, write, execute, etc.

    The "sudo" stuff is because I'm running Ubuntu which discourages the use of supervisor mode.

Topic Closed

This topic has been closed to new replies.

About this Topic