Use google plus for seo

The uploaded file could not be moved to

uploaded file could not be moved toA few hours ago I moved a site from HostGator shared hosting to their VPS server offering.

While the process could have been much smoother, it had several bumps along the way.

None more annoying than the following error when attempting to upload images or media on a post within WordPress:

The uploaded file could not be moved to /var/www/vhosts/yourdomainname.com/httpdocs/wp-content/uploads/2011/11.

In short, WordPress could not upload the image file.

This is the last thing one would want to deal with when migrating a site.

However, it is clearly a permissions issue and needs to be resolved on the server. Since most people are not server administrators, and neither am I, here are all the solutions I researched throughout the web in order from easiest to most difficult.

Hopefully, one of these hacks will work for you.

Set the Default Folder for Uploads in WordPress

1) Login to WordPress and go to Settings > Media.

2) For the input labeled: Store uploads in this folder, specify the following as the value if it is blank:

wp-content/uploads

3) Save changes and test your ability to upload images. If you still have issues, move on to the next solution.

Changing Folder Permissions via FTP

On most VPS servers, you have to set permissions and ownership. Said differently, if you have the ability to set permissions but you are not the owner, then you will not be able to move or copy files into that folder.

WordPress tries to move uploads to the designated folder.

However, if it does not have permission to do so, that would result in an error. It will only succeed if your write permissions are valid. Therefore, make sure your write permissions are correctly set and that you own the /uploads folder. Your FTP client displays the owner of the folder and is usually the username connected to the ftp server.

Below are instructions on how to change folder permissions via FTP:

1) FTP to your server, and navigate to the wp-content/uploads directory.

2) There, change the permissions of the /uploads directory to 777 (i.e., chmod to 777). In most FTP clients, you can right-click on the folder to get to the screen that allows you to change the folder permissions. If it asks you whether you would like to apply changes recursively, enable that as well.

3) Check WordPress by adding a new post and uploading an image. If it works, move on to the next step. If it doesn’t, then move on to the next solution.

4) If the previous step worked, now we’ll go back and change the permission of the /uploads folder to 755 (apply changes recursively). We’re doing this to avoid having a write-able (777) folder which is a security vulnerability.

NOTE: Do not leave your permission set at 777 – it exposes your site to hackers.

5) Check WordPress by adding a new post and uploading an image. If it works, then your issue is resolved. If it doesn’t, then move on to the next solution.

Changing Folder Permissions via Hosting Control Panel

Sometimes, the FTP user does not have the same privileges as the account owner.

To ensure that changing folder permissions isn’t the solution, try logging into your host’s control panel and check the folder permissions from the File Manager.

If they are correct, then move on to the next step. If is is not correct, edit the folder permission there and re-test the upload function through WordPress.

Creating a New Uploads Folder

1) FTP to your server, and navigate to the wp-content/uploads directory.

2) Rename the uploads directory to uploads-old.

3) Now, create a new folder named uploads. Change its permissions to 755.

4) Copy all sub-folders and files from the /uploads-old directory to the new /uploads directory.

5) Check WordPress by adding a new post and uploading an image. If it works, then your issue is resolved. If it doesn’t, then move on to the next solution.

Turn Off PHP Safe Mode

For some folks, turning off PHP Safe Mode may be the solution to this issue. However, not all users will be able to do this as many hosts restrict access or edit privileges to this file.

1) Navigate to your server

2) Locate the php.ini file. It is usually in your /etc directory from the root.

3) Open php.ini in a text editor and change the PHP Safe Mode value (if it exists):

On

to this:

Off

4) If the line does not exist, then add it.

5) Test your upload capabilities in WordPress.

Other Solutions

There are other potential solutions available however they are far more technical and require understanding of critical server files.

Therefore, in the interest of preventing you from causing damage to your site and server, I won’t go into those here. At this point, if you are still having the issue, contact your host and have them resolve it.

Conclusion

I hope this was useful for folks having this image upload issue. Please let me know which solution worked for you in the comments below.

WPsite.net

WPsite.net will feature articles on WordPress (themes, plugins, and tutorials, Internet Marketing, Blogging, SEO, Web Design, and Social Media

26 thoughts on “The uploaded file could not be moved to

  1. If none of these solutions worked, then you really should ask your hosting provider to ensure that uploads are allowed, and if they need to change permissions, they can do it from their end. Send them a support ticket.

  2. If you get this error on a theme file that you want to upload or any other zip file; you can try to unzip and re-zip the file in your local pc and then upload the new zip file to your server. Sometimes especially zip files created in MacOs can cause issues in linux servers.

  3. Thank you very much, the solution “Changing Folder Permissions via Hosting Control Panel” worked for me, much love

  4. Just an FYI, I encountered this issue this morning. Here’s how I corrected it:

    I create test websites on my own server so my clients can see the website as it’s being developed. I have a re-seller hosting account. What the problem was is that I ran out of allotted disk space on my own website’s account because I had it set to one of my lower plans. Simply adjusting the amount of disk space for the account corrected the issue!

    I hope this helps anyone still having the above issue. :)

  5. I hate to say but I am using LAMP on a home Linux mint maya system pc and I have 3 test web sites and only the first worked but then stopped after an upgrade of WP , I tried all the above on the latest version of WP and nothing worked so I guess Ill have to email my self and like most hosting sites wait for an answer lol

  6. I am awaiting quick reply on this.
    Please help..
    This is what i did… Initially i set the permission of the wp-content folder to 777, to allow wordpress to create the “uploads” folder. I noticed in ftp client that the owner of the “uploads” folder was 99, other than the rest of the folders and its permission was 777. I was able to upload media through posts in that folder. Then I went back to change the permission of the”wp-content” folder, but it was already changed back to 755. Then i changed the permission of “uploads” folder to 755 via ftp, it gave error. Then i changed it from file manager in control panel. It changed…or I thot it got changed. But i when i reloaded it, it was back to 777. Whant do I do now?

  7. I am following your advices:

    1) Login to WordPress and go to Settings > Media.
    OK DONE

    2) For the input labeled: Store uploads in this folder, specify the following as the value if it is blank:

    DO NOT SEE THIS OPTION. I only see Organize my uploads into month- and year-based folders which is ticked.

  8. Hi,

    I changed my permissions to 767 and I can now upload. It is not ideal and a temporary fix in my eyes. Has anybody figured out why WordPress suddenly doesn’t work with 755 permissions?

    1. It’s not the best solution, but glad it worked for you. There’s no reason 755 should not work, but this could be more of a server-specific config matter rather than a prevalent issue.

  9. I figured it out for my site. If you have to change your permissions to 777, then (most likely) the www-data user isn’t a user of your var/www/ folders. To make www-data the user and group type the following command in Putty or whatever you use:

    sudo chown -R www-data:www-data /var/www

    chown is for change owners. -R is to make the change recursive (i.e. for subdirectories). the first www-data:www-data is the group and user and /var/www is the folders to which you are applying the user.

    To change the permissions of your /var/www type:

    sudo chmod -R 755 /var/www

    Hope this helps someone.

  10. Thank you so much. Even i called the Customer support of godaddy and they said that there is an issue with your coding.. hoo…. worst support.. thanx a lot dear..

  11. Thanks for this – it was the PHP Safe Mode setting that my host enforces by default which caused the problem.

  12. I have recently come across your blog as I had the very same problem with my website transfer obviuosly it is still left unresolved and awaiting tech support. However I have noticed your blog goes back to 2012. Now the current wordpress version is 3.9.1 and I can’t see the #1 option where I could replace label in the Settings > Media

Leave a Reply

Your email address will not be published. Required fields are marked *

Get 25% off Plugins!

Receive a 25% discount code for DraftPress plugins when you sign up to the newsletter!

We promise never to spam or share your information.
Powered by Popup Fire