Support » Fixing WordPress » Corrupted Image after upload

  • Server information: Windows 2008 / IIS 7 / PHP 5

    After uploading an image using either the flash or browser uploader, the resulting thumbnails work perfectly but the uploaded full sized image results in a 500 internal server error. I have found when looking at the image permissions through Windows Explorer, the owner and file permissions are not being set. Manually forcing an owner and setting file permissions fixes the issue, but manually setting permissions on every uploaded image is obviously not the ideal scenario.

    Has anyone else had this issue where uploaded thumbnails work, but the full sized image does not? and if yes, were you able to find a solution?

    I have tried the upload in several browsers with the same result. I have also disabled all plugins and verified proper folder permissions on all wordpress folders.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Update: This appears to be caused by the URL rewrite and the web.config being written for non IIS servers. Adding the extra text to the web.config IIS needs resolved the issue.

    I am having this issue right now. I upload images and get the 500 internal server error.

    I am using IIS 7.5. This is what’s currently in my web.config file:

    <?xml version="1.0" encoding="UTF-8"?>
    				<rule name="wordpress" patternSyntax="Wildcard">
    					<match url="*"/>
    							<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
    							<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
    					<action type="Rewrite" url="index.php"/>

    Any ideas? Here?

    So the issue lies with how IIS is dealing with the URL rewrite. What you currently have above will allow IIS to properly rewrite the URLs for pages inside of WordPress, but for some reason, it messes up the original, uploaded images. If you were to modify the above to use <match url=”.*”/> then the images would upload and start working properly, but the URL rewrite for the pages will now force all pages to a 404.

    At this point, I have enabled the web.config to work for the pages and have been manually fixing the images. If you have direct access to the upload directory, you can go in and force ownership and read permissions on the main image after it is uploaded. This will allow you to use the image. It’s a very manual, very pain in the butt workaround, but it will at least get you up and running until someone smarter than us for IIS and wordpress can find a wildcard combination that will allow both the images and the pages to be URL rewritten properly.

    I have tried writing 2 rules in my web.config to deal with both conditions, but I have been unsuccessful.

    (side note: all of the thumbnails that wordpress creates will work fine without the 500 error. it only appears to be the uploaded original image that is breaking)

    Thanks for the reply. Yes, hopefully we can get someone here with some more knowledge. To add to your sidenote, the medium and large versions work fine. Another twist is that when you wrap Timthumb around the full size image, it works.

    What file permissions are you manually adding to the full size image?

    I put in an ticket request to my server’s support crew. Hopefullly they have the magic answer.

    Just got this message back from our hosting company:

    You should be good. It seems the temp directory for php did not have the right permissions so when you uploaded an image, it passed along those permissions. I believe I have fixed this now.

    If you are curious, this is the site that lead to the answer

    Hopefully this helps you!

    That fixed it! Beautiful.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Corrupted Image after upload’ is closed to new replies.