Fixing image/file upload errors in IIS 6 and 7

Fixing image/file upload errors in IIS 6 and 7

There can be a number of reasons why your image upload process fails. The server may not have an image upload component such as ASP Jpeg installed or if it is installed it may be corrupted and needing re-installation, the folder you are uploading the file to may not have enough permissions or the server itself may be limiting the file size as the default maximum is only 200kb.

If you have set folder permissions correctly and you know uploading a smaller file works then the most likely culprit of errors when trying to upload images or files to your web site is the servers default file size settings are too low.

You need to make sure the IIS web server is not restricting the size of ASP uploads. For example: IIS 6 (Windows Server 2003) has a limit of 200 KB for ASP requests in general and file uploads in particular. To remove this limit in IIS there are different instructions depending on your version of IIS.

For IIS 6:

  • Go to IIS and right click the server, select properties, and check the box "Allow changes to MetaBase configuration while IIS is running"; if after this step the metabase file is still locked, try turning off IIS or even restarting the machine in safe mode.
  • Open in a text editor the Metabase file, which can be found at c:\Windows\System32\Inetsrv\MetaBase.xml.
  • The variable AspMaxRequestEntityAllowed limits the number of bytes in the page request (by default 200KB); change the value to 1073741824 (unlimited) or to a limit of your choice.
  • Check whether the same variable shows up in other places in the file and change them too.

For IIS 7:

  • Highlight your website, then open the "Advanced Settings..." link in the right-most panel. Set "ConnectionTime-out (seconds)" to a much bigger number. For example: "3600", which is an hour. Close "Advanced Settings...".
  • While still highlighting your website, click on the "ASP" tab, then expand "Limits Properties" and set "Maximum Requesting Entity Body Limit" to 1073741824.
  • Finally, open a command window as an administrator and run the command "c:\windows\system32\inetsrv\appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:100000000". This tells IIS the largest amount you may upload, in this case, it's 100MB. You may set your number accordingly.

Once you have made your changes reboot the server.

Times Viewed:
Added By:
Cam Flanigan
Date Created:
Last Updated: