WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Media Upload Problem (The uploaded file could not be moved to error) (42 posts)

  1. Tony Stark
    Member
    Posted 5 years ago #

    Hi,

    I have read several posts which seem to relate the issue I am having but on a brand new install (which is working as far as viewing and admin is concerned) I cannot upload files to the media library? This is on a VPS (Debian) box. I try to upload files and I get the following error:

    The uploaded file could not be moved to /var/www/vhosts/myblogdomain/httpdocs/wp-content

    None of the posts seem to have a concrete answer? Anyone know what is causing this and more importantly, what can be done to fix it?!

    Thanks

    Tony

  2. Samuel B
    moderator
    Posted 5 years ago #

    the 1st time try chmod 777 on /wp-content
    after that chmod 755 should work

  3. Tony Stark
    Member
    Posted 5 years ago #

    Hey Samboll,

    Apologies, I am a newbie on SSH (normally a Windoze man for my sins! but I am slowly converting ;-). I am using FileZilla to change permissions. I set the permissions on that folder (do I ensure it cascades?) to 777 and I can now upload but I cannot actually see the image in the admin or front-end.

    What I have noticed is that there is no "uploads" folder and even if I manually create one it just puts the media etc into the root of the site anyway. Do I even need it?

    What is so damn annoying as my dev install on WAMP works out of the box!

    Thanks for your help so far, I look forward to try and resolve this once and for all!

    Tony

  4. Samuel B
    moderator
    Posted 5 years ago #

    look in
    admin - settings - miscellaneous
    and see what folder you have there
    if necessary, create one under /wp-content and chmod it 777 also and should work

  5. Tony Stark
    Member
    Posted 5 years ago #

    Yep, it is the default but didn't exist - created it and it can upload but the same problem as in the other post - I cannot actually see the images in the admin or front end when embedded in pages!?

    So the problem is only part fixed.

  6. Tony Stark
    Member
    Posted 5 years ago #

    correction! it is sorted now! ;-) WAHOO... thanks samboll, credit to the community.

  7. Tony Stark
    Member
    Posted 5 years ago #

    LOL - I make a change by checking the "Organize my uploads into month- and year-based folders" box and it breaks again!

    WTF!?!?

  8. makeitcount
    Member
    Posted 5 years ago #

    I had this image upload problem.
    Your fix worked straightaway.
    However I read several solutions before it dawned on me exactly what I needed to do.
    This is it;
    1 Use your ftp client to open the folders on your website.
    2 Right click the wp-content folder and open "properties".
    3 There you will see the chmod 775 setting. Change it to 777.
    4 Do the same to the "uploads" folder.

  9. nipponese
    Member
    Posted 5 years ago #

    I have a security question: Is it really safe to leave these directories in 777? I have seen a lot of WP advice sites that recommend never using 777. However, I can't get media uploads to work any other way.

  10. Hoodedmonkey
    Member
    Posted 5 years ago #

    Wow MakeitCount you are a legend!!!!!

    Thank you so much you are the only person I've found that posts information so it's easy to follow.

    Cheers dude

  11. chuckiej
    Member
    Posted 5 years ago #

    If chmod 777 is the answer for every wordpress problem then wordpress is one big security hole. Stop telling people to do that!

  12. MPESGT01
    Member
    Posted 5 years ago #

    OK, I did have this same exact probleme and steps as above. I know many people got this trouble. After a couple tries, I gave up I found this post via Google. Thanks. But not working for me, so here is what I did and now it is working super fine !
    (seems like the installer of WP was missing stuff)

    - login to your ftp
    - make your wp-content folder 755
    - inside wp-content create a new folder called "uploads", make it 777
    - inside the control admin panel, go to settings>miscellaneous and on the first line enter "wp-content/uploads" as where your uploads will go to.
    Save and go try to ad a new image in a post and it will work superb !

  13. Vera Schafer
    Member
    Posted 4 years ago #

    I had the above suggestions working fine until today, after upgrading WP.
    Now I'm getting same error messages reported here. I noticed that the files I had before were uploaded to a folder 07 (created by WP for July) bearing my username as the owner. But the folder created today (by WP?) for August, show "Apache" as the owner. Does it make a difference?

  14. adamfake
    Member
    Posted 4 years ago #

    I'm noticing the same issue as what 'vschafer' has pointed out. I am not the user on the '2009' folder within the uploads folder, 'Apache' i, i'm thinking this has something to do with why i can't upload images!

  15. henkholland
    Member
    Posted 4 years ago #

    Yup, as soon as I let WP create the folders they are owned by 'Apache" and I cannot upload to them, regardless of CHMOD settings.
    So I created the folder Uploads manually over FTP and chmodded to 0755. Of course then I can not set in Admin the archiving on a Year/Month basis because WP would create a new folder each Year/Month which I cannot upload to.
    So everything is in Uploads; a bit messy but there is the "Unattached" indication in Admin/media.

  16. ctingom
    Member
    Posted 4 years ago #

    Try turning off PHP Safe Mode. That solved it for me.

  17. teafrog
    Member
    Posted 4 years ago #

    Also check that the directory your files are being saved to before being moved is accessible under the open_basedir setting.

    I had this issue where the open_basedir was set only to my hosting directory by my host provider, and the /tmp directory where the files are uploaded to initially needed to be accessible.

    You can test this by writing or finding online a quick PHP upload script, turn on display_errors and check the error returned when you try uploading an image or file.

  18. smprather
    Member
    Posted 4 years ago #

    Seriously? chmod 777 is the "fix" for this? WordPress is the most ubiquitous blogging software on the net. I know it's free, and I really do appreciate a whole lot of somethin for nothin, but come on. There's got to be a better way.

    Maybe not.

  19. smprather
    Member
    Posted 4 years ago #

    That doesn't work either. My directories now look like this:

    [myles@ldc873 nicole]$ ls -ld wp-content
    drwxr-xr-x  6 myles psacln 4096 Sep  9 02:08 wp-content
    [myles@ldc873 nicole]$ cd wp-content/
    [myles@ldc873 wp-content]$ ls -l
    total 20
    -rw-r--r--  1 myles  psacln   30 May  4  2007 index.php
    drwxr-xr-x  3 myles  psacln 4096 Aug 11 20:47 plugins
    drwxr-xr-x  4 myles  psacln 4096 Aug 11 20:47 themes
    drwxrwxrwx  2 apache apache 4096 Sep  9 02:08 uploads

    Yet, I'm still getting:

    The uploaded file could not be moved to /var/www/vhosts/nicoleandmyles.com/httpdocs/nicole/wp-content/uploads.

    Which I don't understand. I thought php is running as apache:apache. Why can't it move a file from /tmp to the .../uploads directory? But it works when I make it myles:psacln w/ 777 permissions.

  20. diablien
    Member
    Posted 4 years ago #

    Hey all, I've had the exact same problems list above. I believe turning off the monthly sorting of the images was the only thing that helped. Images FINALLY upload.

    Info on my uploaded files still indicate that they are being written and owned by user "apache". That seems to be the root of the problem. If anyone discovers why this is happening, please post it here!

    Thanks for all the suggestions.

  21. Vera Schafer
    Member
    Posted 4 years ago #

    I decided to simply create a folder via FTP for each month (07, 08, 09 ...) and it worked. I'll be doing this until I figure something else. It's not a big deal for me to create the folders anyway ... :)

  22. mdsrubia
    Member
    Posted 4 years ago #

    Changing the CHMOD of the contents folder does not work. Nothing does as suggested above. FTPing all my files work BUT I cant see them as admin browsing my gallery. Im linking "blind" in HTML format. If anyone knows any other solution other than those mentioned above, please post. Would greatly appreciate the help :-(

  23. javalama
    Member
    Posted 4 years ago #

    I had a custom theme created and from the very start I have never been able to upload an image. I have read the posts and it seems like greek to me. I would appreciate it greatly if someone could walk me through this. Here is the message I get when ever I try to upload an image to wordpress:

    The uploaded file could not be moved to D:\Inetpub\javalama/wp-content/uploads.

    Please help!

  24. bobstilger
    Member
    Posted 4 years ago #

    So, even though this topic is marked as resolved, it doesn't seem to be. Is this simply a problem that cropped up in the current instance of WP, and we have to wait for another update?

    As far as I can tell from reading through this, many of us are facing multiple problems with the media library upload.

    Is there a fix someone can explain?

    I know I am missing some basic things here. When I read:

    - login to your ftp
    - make your wp-content folder 755
    - inside wp-content create a new folder called "uploads", make it 777
    - inside the control admin panel, go to settings>miscellaneous and on the first line enter "wp-content/uploads" as where your uploads will go to.
    Save and go try to ad a new image in a post and it will work superb

    I don't know what it means to make a folder 775 or 777. It doesn't seem to mean renaming it. Where would I make these changes? Sorry!

  25. Vera Schafer
    Member
    Posted 4 years ago #

    If you are on a mac, you just right click the folder or file located in the server via FTP, click on Info and enable the "write" and/or "execute" options until you see it displaying 777. I forgot how to do it on Windows cause I haven't worked on it for a long time but I guess you have to go on Properties, but I guess you can google it :>)

  26. Mossotti
    Member
    Posted 4 years ago #

    I can't figure out if this is a user error or a program issue. I have had my site for a couple years and never encountered this issue. I have recently changed hosting companies. I transferred the blog and I am having a similar problem. The only thing that changed is the WP version was updated.

    I have tried every fix technique listed on these forums and if someone mentions changing the permissions to 777 again my head will explode.

    I can manually upload content to the proper directories and use html to get the job done, but I also host 2 other WP sites for individuals without access to an ftp (filezilla) type directory system.

    In any given post when I go to add new media content, then browse the computer for the files, WP will upload, but to nowhere. The file is not located in any directory anywhere in my database. I have set my miscellaneous settings to wp-content/uploads storing the files in a year/month format but the files are not actually placed in any directory. Even with 777 on the directories permissions.

    The only thing I can think could be contributing to the issue is that I have a total of 6 sites operating under one hosting account. So my personal site joshmossotti.com it a child to artbyfable.com. However the parent account does not have anything to do with regards to the directory structure of the personal site.

    I am not sure if I feel better or worse that there are this many people experiencing similar issues. I will continue to check back to see if there is either an update or a fix.

  27. Vera Schafer
    Member
    Posted 4 years ago #

    I suggest you post it as a new link. Since this page shows this issue as "Resolved" it is probably not reaching the geeks on duty. I did this for another issue and I got help from a good samaritan within a few minutes and all the way until I got my problem resolved. Since I'm a newbie I recommend you to go that way. I know how to fix 777 via FTP using a free application called Cyberduck but I'm a Mac user. But there must be hundreds out there that are Windows users and that are more experienced than I am. I got your post just because I still had this thread on my RSS reader but I don't think you will be lucky getting answers faster via a "Resolved" post.

  28. bmunchausen
    Member
    Posted 4 years ago #

    Permissions for upload directories must be set to 777 because being a web application WordPress runs as the user apache and not as owner. The 'uploads' directory needs to be created manually via SSH or FTP and set to 777, as well any directories inside, such as '2009', and the directories inside that, i.e. '10', '11', '12', etc. Web applications such as WordPress have limited abilities to create directories.

  29. SanchoPancho
    Member
    Posted 4 years ago #

    I think you are all missing the point here. Remember that on a unix / linux server you have to set permissions AND ownership. You can set permissions on a folder but if you are not the owner than you can't copy files in there.

    When you upload files with the media form in WordPress, files are being stored in a temporay location. When the upload is succesfull WordPress tries to move them to your upload folder. Normally that is wp-content/uploads. It will only succeed if your write permissions are ok (and no, 777 is not needed, just make sure that you have write permissions. 666 should be enough.

    When the write permissions are correctly set you should make sure that you own the uploads folder. Your FTP client should show who owns the folder. This should be the loginname that you use to connect to the ftp server.

    I noticed when I had the problem that the owner of the uploads folder was not correct. So I used the quick and dirty solution:

    1. rename your uploads folder to uploadsold
    2. make a new uploads folder and set the permissions to 666
    3. drag the contents of the uploadsold folder to the uploads folder
    4. remove the now empty uploadsold folder (check first)

    Presto your done! Uploading now works like a charm because both owner and permissions are ok. No SSH access needed. Just use your FTP client.

    Astalapasta from The Netherlands,

    Stef

  30. s_ha_dum
    Member
    Posted 4 years ago #

    You need to set permissions to 755 on the uploads directory then find out which group the web server belongs to and set the group on uploads to that value. So, for Apache at least,...

    1) Run a phpinfo() script.
    2) Look for the 'User/Group' line. That will tell you the user and group Apache runs under. On my local devel server it runs as part of the group 'daemon'.
    3) cd to wp-contents if you aren't already there, create the uploads directory if it isn't there, and then chown <owner>:daemon uploads. (Or use your ftp client as already explained up above.) You shouldn't have to mess with the owner so just keep that value as it was.

    You might have to ask your web host to make some of these changes for you. You can probably change permissions but you might not be able to change the group.

Topic Closed

This topic has been closed to new replies.

About this Topic