The default setting of the IIS web server allows you to upload only up to certain size of image file to the web server. The default image file sizes are 5 MB and 29.6 MB. If you tried to upload an image file of size more than 30 MB it will be shown as error in the web server. Here is the good news. You can upload an image file of desired size by making slight changes and modifying the settings of the web server. Let’s discuss about the settings that you should modify in order to enable the allowance of uploading image files of sizes that are more than 30 MB. There are three options in this step.
Option 1: To modify the maxAllowedContentLength setting in the web.config
This is one of the methods to increase the default setting size of the image file. For this you should follow,
By following the above maxAllowedContentLength you can upload image files that are more than size of 30 MB.Code:< system.webServer > < security > < requestFiltering > < requestLimits maxAllowedContentLength= “214783648” / > < / requestFiltering > < / security > < / system.webBrowser >
Option 2: To edit the features settings by filtering and enable the desired limit in the IIS manager
- The first step is to open IIS manager.
- Now select the website that should be configured.
- Do a confirmation check that you are in the features view that can be found on the bottom of the IIS manager.
- Click on the option request filtering and double click on the icon. Now you will see a request filtering pane displaying on the screen.
- Now click on “edit feature settings” that can be found on the right side of the screen in the pane displayed. Now the “Edit request filtering settings” window will open on the screen.
- Now in the section called “Request limits” enter the desired maxAllowedContentLength in Bytes. Then click on OK option.
Option 3: To manually edit the file ApplicationHost.config
- The final step is restarting the IIS web browser. Now you are ready to go.
- Find start option and click on it. In the search box search for “Notepad”. Now right click on notepad. Then choose “Run as administrator”.
- The next step is to go to the file menu. Click on open. The file name box will appear. In that box type %windir/system32/inestv/config/applicationhost.config. After completing this click on “Open”.
- Find the <requestLimits> option in the ApplicationHost.config file.
- Now remove or delete the maxAllowedContentLength option or function. If not you can also add the value or number that can be of matching to the content length header which the client will be sending as a part of request. The default value of the maxAllowedContentLength option is 30000000.