by Andreas

ASP.NET Large file uploads using FileUpload controller

If you are using a FileUploader component on your webpage you will soon realize the ~4MB limit, which triggers an ugly exception for users that attempt to transfer files larger than that.

image

Before you start implementing a bit stream functionality or splitting up the files client side (which in some cases sure would be a good solution) at least consider if the easy way will work for you. There is a default 4MB limit set in the machine.config file, which like most other settings can be overridden by the application web.config (and therefore also web.config for sub folders). Add the following line to the system.web tag:

<system.web>
<!– increate the max upload limit to 20MB –>
<httpRuntime executionTimeout=”240″ maxRequestLength=”20480″ />
</system.web>

Be aware that the upload limit is there for a reason.. One possibility is denial of service attacks using large files to choke your server, so use this with some caution.

PS: It would be unethical of me not to mention another option if you want to transfer large files: use Filemail.com ! Their business IS large file transfers – be sure to check it out!