开发者

Cannot upload images when WordPress is sat on a virtual host configuration

This is my first post to this Forum, please forgive me if this has been answered elsewhere--I did search and was unable to find an answer to my particular problem, so any help would be greatly appreciated.

I am working on a WP site for a client who wants to upload images to new posts (who doesn't hey?). In setting up the site I have done the following:

1) Enabled File Upload by CHMOD default dir to 777. 2) Changed max file size. 3) Changed allowed filetypes to include necessary file types.

When I try to upload anything I get the following error:

“Bobst Expertfold 80 110 (Dec 2010).jpg” has failed to upload due to an error The uploaded file could not be moved to /var/www/vhosts/glossopcartons.com/httpdocs/wp-content/uploads/2010/12.

The above error mentions 'glossopcartons.com', this WP site is actually sat on glossopcartons.co.uk. It's obvious that there is some kind of virtual host configuration going on and the image is trying to be uploaded to a folder on a different domain (glossopcartons.com instead of glossopcartons.co.uk).

I don't manage the hosting, I have just been assigned with the build. However, I h开发者_如何学编程ave access to the plesk cpanel but I dont know what I need to do?

Does anyone know what is causing this problem? The site has actually been made live and this issue has been spotted after the launch(everything worked fine on the test server), and I am scratching my head trying to figure it out.

Is there something I can put in my wp-config.php or .htaccess file to tell WP to upload to a different location.

Any help would be greatly appreciated.

Dan


First thing is 777 permisions are too loose and will get you hacked; they should be no more than 755. Hardening WordPress « WordPress Codex

For the difference in URLs: that sounds like a DNS or virtual host config, but try adding the full URL path in Settings>>Media Settings. Might not work.

Why are there sites at both domains? Why not domain forward glossopcartons.com to glossopcartons.co.uk?


Make sure PHP lets you upload files larger than what you are trying to upload.


Experienced the same problem on several old sites. This problem occurs sporadically and is not commonly occuring on other websites on the same server

Try going to your "Media Settings" page... do you see a "Store uploads in this folder" option with a long path to your uploads folder? If so... this is your problem... WordPress 3.5+ does not seem to require this long path, but more of a site relative path (which is great!)

Change your "Store uploads in this folder" to "wp-content/uploads"... when you "save settings" you should see that field disapear entirely, never to bother us again ;-)

This occured for me when my hosting provider changed the folder structure on the server making this long URL incorrect. Therefore WordPress could not find the "uploads" directory at all.

Hope that helps...

Here's some things you might want to check in case your still having problems...

Update to WordPress 3.5 + Update all plugins Check file permissions 755 on the uploads dir/ Check PHP version

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜