Blogger Templates


Standard Upload Mode

Standard Upload Mode is enabled if the ASPxUploadControl.UploadMode property is set to UploadControlUploadMode.Standard.

This is a standard FileUpload-based upload mode in which the uploaded file is sent to the server in one request and is cached in its entirety in server memory. This mode works well with small files, but is not suitable for uploading large files (such as 1GB). The ASP.NET worker process has a virtual address space of 2 gigabytes (GB). However, the ASP.NET worker process only uses a little more than 1 GB because of health monitoring and memory fragmentation (see the Cannot Upload Large Files... Microsoft topic for more detail).

Additionally, ASPxUploadControl requires memory for progressing. Therefore, the real maximum size of a file, which can be uploaded using ASPxUploadControl in the standard upload mode with enabled progressing (the ASPxUploadControl.ShowProgressPanel property is set to true), is about 2GB/3 = 633MB.

Allowing large file uploads in this mode also requires increasing the Request length limit (via a Web.Config file's maxRequestLength configuration setting), which is not protected against the rejection of service (DoS) attacks that are caused by users who post large files to the server.

Advanced Upload Mode
To enable the Advanced Upload Mode, set the ASPxUploadControl.UploadMode property to UploadControlUploadMode.Advanced. You can access and customize the settings that relate to the Advanced Mode using the ASPxUploadControl.AdvancedModeSettings property.

In this mode, the uploaded file is sent to the server in small packets (one by one) and is saved into a temporary file within a specific server folder.

The Advanced Mode's implementation is based on modern technologies provided by Microsoft Silverlight. So it is required that your end-users have the Silverlight plug-in (version 3 or later) installed in their browsers. If this plug-in is not installed or is disabled, a specific message is rendered instead of the ASPxUploadControl, providing end-users with a Silverlight download link.

Using the Advanced Mode has the following benefits.
  • Uploading Large Files Sending a file in small packets allows end-users to upload large files (up to 2GB) without using a huge amount of web server memory, because only one packet per file is stored in memory at one time. The packet size (which by default is 200 kilobytes) can be customized via the UploadAdvancedModeSettings.PacketSize property. A server folder to which each uploaded file is saved can also be specified via the UploadAdvancedModeSettings.TemporaryFolder property (default path is "~\App_Data\UploadTemp\").
    After the file upload is finished, you can access the uploaded file as a file stream by using the UploadedFile.FileContent property of the related UploadedFile object, while handling the ASPxUploadControl.FilesUploadComplete or ASPxUploadControl.FileUploadComplete server event.
        protected void ASPxUploadControl1_FileUploadComplete(object sender, FileUploadCompleteEventArgs e) {
            using(Stream stream = e.UploadedFile.FileContent)  {
    When using the Advanced Mode, operating the uploaded file's stream within the using statement (Using statement in Visual Basic) is required.
    Refer to the Uploading Large Files topic to learn more on how to customize ASPxUploadControl for large file uploads.
  • Preventing DoS Attacks In the Advanced Mode, you are not required to define a large value for the Request length limit (controlled by the maxRequestLength configuration setting within Web.Config), since large files are sent in small chunks. A large value of maxRequestLength makes a website more vulnerable to the rejection of service attacks that may be caused by end-users posting a great number of large files to the server. So using the Advanced Mode allows you to keep the Request length limit reasonably small, preventing potential DoS attacks.
  • Client-Side Validation Using the functionality provided by Microsoft Silverlight, ASPxUploadControl is able to validate the file size and extension directly on the client side without sending files to the server. This prevents unnecessary traffic to the web server. Client validation is invoked automatically if the ValidationSettings.MaxFileSize or ValidationSettings.AllowedFileExtensions property is defined. After a file has passed client-side validation, ASPxUploadControl also performs a server-side validation check giving you extra protection.
  • Progress Indication in Medium Trust With the Advanced Mode, the functionality of upload progress indication (controlled by the ASPxUploadControl.ShowProgressPanel property) works well in web environments that only allow medium trust. In contrast to the Standard Mode (where the current progress is not updated until file upload is completed), indication of the current progress is updated after each small file packet is uploaded.
  • Multi-File Selection in File Open Dialog In an Advanced Mode, ASPxUploadControl supports the multi-file selection capability, allowing end-users to choose several files to upload within a single file open dialog. Refer to the Multi-File Selection topic to learn more.