Mehul Harry's DevExpress Blog

This Blog


Mehul Harry is the DevExpress Web Program Manager. Follow him on twitter: @Mehulharry

Subscribe (RSS, Email)


ASP.NET Upload Control (WebForms & MVC) - Upload Large Files using less RAM! (available now in v2011.1)

Check out the upcoming feature of our ASP.NET Upload Control that lets your end-users upload very large files without having your web server use lots of memory (RAM). And there are other benefits too.

Watch my 'Upload Big Files' video to learn about the new feature in DXperience v2011 volume 1:

Video: ASP.NET Upload Large Files

ASP.NET WebForms & MVC!

First, you'll be happy to know that the new 'upload large files' feature will be supported by both of our ASP.NET Upload WebForms control and ASP.NET MVC Upload Extension!

New Property

A new property is being introduced for our ASP.NET Upload Control and MVC Upload Extension called UploadMode. And it has 2 modes that determine how the upload control will behave and render:

  • Standard - Current/old mode - the upload control will send a file in one request. For small files, this is fine but if the file is very large then it can stress your web server as it has to load the entire file in memory
  • Advanced - New mode - the upload control will send a file using small packets. This gives you a few benefits…

...Benefits? Yes there are some pluses to 'Advanced' mode and one small caveat.

Advanced Mode Benefits

There are major benefits that you get when using the new 'Advanced' mode for uploading:

1. Upload Large Files

Upload large (2 gigabyte) files without using a huge amount of memory on your web server because the 'Advanced' mode uploads the file in small packets. The default PackedSize is 200 kilobytes and it saves these bytes to a temporary folder on your server (default is "~\App_Data\UploadTemp\").

When the upload has finished, you can access this file using the file stream:

protected void ASPxUploadControl1_FileUploadComplete(object sender, FileUploadCompleteEventArgs e) { 
    using(Stream stream = e.UploadedFile.FileContent)  { 

Or save the file using the SaveAs method:

protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.ASPxUploadControl.FileUploadCompleteEventArgs e) {
    // don’t use FileBytes with Large Files!
    // byte[] a = e.UploadedFile.FileBytes;
    string filePath = Server.MapPath("~/uploads/" + e.UploadedFile.FileName);
    // DoProcessUploadedFile(filePath);

2. Client-side Validation

The new 'Advanced' mode will validate the file size and extension on the client-side without sending files to the web server. This prevents unnecessary traffic to the web server. And to ensure proper validation and give you extra protection, our ASP.NET upload control will also perform a server-side validation check once the file has passed client-side validation.

3. Progress Bar in Medium Trust

'Advanced' mode also allows you to display the file upload progress bar even in web environments that only allow medium-trust. Learn more about 'medium-trust' ASP.NET applications from this MSDN article. In general:

Medium trust will place a number of restrictions on an application, including limiting an application’s file access to within the virtual directory where the application lives. - K. Scott Allen

4. Prevent DoS Attacks

With the 'Advanced' mode, you also don't need to set a very large 'maxRequestLength' value in your web.config file. The 'maxRequestLength' property specifies the limit for the buffering threshold of the input stream. For example, this limit can be used to prevent denial of service (DoS) attacks that are caused by users who post large files to the server.

Silverlight Required

The small caveat to the new 'Advanced' mode is that it requires Silverlight (version 3 and above) to render the upload control. This will require your end-users to have the Microsoft Silverlight plugin installed in their browsers. And we still provide the 'Standard' mode which uses standard HTML.

We chose to use Silverlight so you can quickly deliver to you a robust, proven solution for uploading large files. And by using Silverlight in the 'Advanced' mode, you get more benefits.

Available Now In v2011 vol 1

The new 'Advanced' mode feature of our ASP.NET Upload WebForms control and MVC Extension is available now with the DXperience v2011 volume 1 release.

What do you think of the slick new features in our ASP.NET upload control? Drop me a line below with your thoughts. Thanks!

DXperience? What's That?

DXperience is the .NET developer's secret weapon. Get full access to a complete suite of professional components that let you instantly drop in new features, designer styles and fast performance for your applications. Try a fully-functional version of DXperience for free now:

Follow MehulHarry on Twitter

Published May 12 2011, 08:08 AM by
Bookmark and Share


Denny Upadhyaya

Very nice feature. You should rename the Mode to : Standard and Silverlight Enhanced since that is a requirement

May 12, 2011 11:57 AM

Luke Grews

Great feature,

But I would agree with Denny on SL Mode.

Then Silverlight requirement will be implied.

May 12, 2011 2:25 PM

Paul Barnes

Mehul, a few of my clients have asked for the ability to drag a file from windows explorer into an aspxuploadcontrol. Has this abilty ever been discussed with you guys? Thanks.

May 13, 2011 4:16 PM

Mehul Harry (DevExpress)

Luke and Paul,


We didn't want to call it 'Silverlight Advanced' because we may still improve this feature by using other technologies like html5, SL, or flash in the future. We'll use the one that gives you the most benefits. :)

May 13, 2011 4:48 PM

Mehul Harry (DevExpress)

Hi Paul,

I recommend creating a suggestion for that.

Also, this may help you but it's browser-specific so not the best sln, imo:


May 13, 2011 4:50 PM

Paul Barnes

Thanks for the quick reply. Since it can not be supported because of it being browser specific, can I suggest it be considered in the advanced mode that uses silverlight?

May 16, 2011 10:16 AM

Mehul Harry (DevExpress)


We'll certainly consider it, thanks.

May 23, 2011 5:12 AM

Robert hovhanessian

a nice feature would be "Auto" mode.... checks if silverlight is already installed, if it is, then does advanced, if not, falls back to standard. Or maybe there's already a way to do this in page_init/load?

July 18, 2011 10:30 PM

Mohammad Alnasser

In medium trust environment it gives following error

Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

December 8, 2011 2:33 AM

Mehul Harry (DevExpress)

Hi Mohammad,

Please contact our support team here about the issue:


December 8, 2011 2:14 PM

Charles Welden

Does this also support files of 10GB or more?   We are having to upload large video files to our webserver.



November 1, 2012 4:40 PM

Mehul Harry (DevExpress)


Most browsers and web servers have a limitation of 2GBs. For large uploads, its probably better to use FTP.

November 1, 2012 4:49 PM

About Mehul Harry (DevExpress)

Mehul Harry is an ASP.NET technical evangelist at Developer Express. You can reach him directly at You can also follow him on Twitter:

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at or call us at +1 (818) 844-3383


DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, Delphi, HTML5 or iOS & Android development. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2018 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners