Friday, September 23, 2005

"Your file is too big for me" - ASP.NET and Request Length

I had a strange problem appear the other day, i have an form that allows users to upload images of broken down machines in the field. This program worked great until someone tried uploading a 5MB file. Turns out the errors given by IE and FF are pretty much useless to try and figure out what is causing this, both browsers give a generic "fuck you" error message. The IIS logs just add a little insult to injury too. But it turns out its a simple parameter in machine.config the parameter is "MAXREQUESTLENGTH" by default this value is 4096K (4MB), changing this bad boy to anything above that and 5MB image upload works like a champ. Although set the setting too high and people will abuse. Also anybody out there buying a "58,000 megapixel " digital camera to take a picture of a flat tire, do yourself and everybody else a favour and set the damn picture size (I purposfully avoided the term "Quality" because picture size and quality are too different animals) down to a reasonable size. For your average picture, that you will be emailing to friends setting your camera's resultion down to 400 x284 pixels by 24 million colours will result in a good picture quality (although you won't get good enlargement capabilities) and good physical file size, that is good for email and web use.

You may want to also consider a upload handling tool such as our SlickUpload component.

This will enable you to scalably handle large uploads, give good error messages, and provide rich progress feedback to the user in real time during the upload.
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?