Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 1261
How to upload over 2 GB with FileUp in ASP.NET
While FileUpSE can process uploads up to 4 GB and FileUpEE can process uploads of any size, ASP.NET will not accept upload requests larger than 2 GB. This is because the maxRequestLength attribute in the httpRuntime section of web.config (or machine.config) cannot be set to a value larger than 2097152 KBytes, which equals to 2 GB. This is also the maximum value that an integer can hold.
To overcome this request size limitation imposed by ASP.NET, chunked transfer-encoding must be used.

A chunked request does not include a content-length header for the whole request. A chunked file transfer is sent as a series of chunks, each preceded by its own size indicator. ASP.NET will not reject the large request because it contains no content-length header. The maxRequestLength setting in web.config will be ignored. With chunked-transfer encoding, no matter how large the upload request is, it will not be dropped by ASP.NET.

Since browsers currently do not support chunked transfer encoding, XFile needs to be used on the client, and chunked transfer encoding has to be turned on in the client-side script using the TransferEncoding property of the XFRequest object. The code snippet below sends the upload request to the server using XFile with chunked encoding turned on when the user clicks an HTML Button:

function UploadButton_OnClick()
  /* "xFile" is the instance of the XFRequest object 
   *  created in the <OBJECT> tag 

  // Set the URL to which the upload will be posted
  xFile.CurrentURL =
  // Set Timeout for XFile (in seconds)
  // Set to -1 so that XFile won't time out during the transfer
  xFile.Timeout = -1;  
  // Turn on chunked transfer-encoding 
  xFile.TransferEncoding = 1;
  // Set the files to be uploaded

  // Begin the transfer
  // Disable the upload button
  document.all("UploadButton").disabled = true;


3-tier uploads with FileUpEE

Not only can FileUpEE handle unlimited sized uploads, it can also perform 3-tier uploads to a secure isolated fileserver.

Turning on chunked transfer encoding in XFileEE as seen in the code above assures that the “client-to-webserver” part of a three-tier upload transfer will be chunked. However, if you are doing a 3-tier upload, you will also need to configure the "webserver-to-fileserver" part of the transfer to handle over 2 GB.

For the “webserver-to-fileserver” part of the transfer, FileUpEE uses the HTTP layer to send a SOAP request to the fileserver, and this request is not “chunked” by default. Therefore ASP.NET will reject the request when it arrives on the fileserver due to the maxRequestLength limitation.

In order for FileUpEE to send a request over 2 GB to the fileserver in chunks, chunked transfer encoding needs to be set explicitly on FileUpEE using the set_TransferEncoding method in C# (or the TransferEncoding property in VB.NET) in the webserver processing page as shown in the code-snippet below:

[C#] [VB.NET]  

public void processUploadOnWebServer()
   // Instantiate the FileUpEE object
   FileUpEe oFileUpEe = new FileUpEe(); 
   // Set the TransferStage to saWebServer
   oFileUpEe.TransferStage = saTransferStage.saWebServer;
   // Turn on chunked transfer-encoding on the WebServer stage 
   // Set the URL of the fileserver script
   oFileUpEe.TargetUrl = 

   // Set the directory path on the fileserver to which the uploaded files 
   // will be saved  
   oFileUpEe.DestinationDirectory = 

   // Process the Request data sent from the client
   oFileUpEe.ProcessRequest(Request, false, false);

   // Send the HTTP request to the fileserver
   saResult result = oFileUpEe.SendRequest();



Note: There was a known issue in certain versions of FileUpEE with turning on chunked transfer encoding on the webserver. This issue has been addressed and fixed in a pre-release build of FileUpEE. For more information, see this KB article: Three-tier chunked uploads with FileUpEE do not work properly

Created : 12/31/2007 5:58:14 PM (last modified : 5/19/2009 7:21:24 PM)
Rate this article!