Back to Devexpress

Upload Modes

aspnet-9886-components-file-management-file-upload-concepts-upload-modes.md

latest5.0 KB
Original Source

Upload Modes

  • Jun 21, 2024
  • 5 minutes to read

ASPxUploadControl allows you to use the ASPxUploadControl.UploadMode property to choose from two upload modes ( Standard and Advanced ). You can also set the property to Auto to select the upload mode automatically.

Standard Upload Mode

Set the ASPxUploadControl.UploadMode property to UploadControlUploadMode.Standard to enable Standard Upload Mode. You must also set the FileManagerUploadAdvancedModeSettings.EnableMultiSelect and FileManagerUploadAdvancedModeSettings.EnableDragAndDrop properties to false.

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

Additionally, ASPxUploadControl requires memory for upload progress visualization. Therefore, the actual maximum size of a file that can be uploaded in Standard Upload Mode with upload progress visualization enabled (the ASPxUploadControl.ShowProgressPanel property is set to true) is about 2GB/3 = 633MB.

When you allow large file uploads in this mode, it also requires that you increase the Request length limit (the Web.Config file’s maxRequestLength configuration setting), which is not protected against denial-of-service (DoS) attacks caused by users who post large files to the server.

Note

In Standard Upload Mode, a file upload is initiated automatically on the next postback.

Advanced Upload Mode

Set the ASPxUploadControl.UploadMode property to UploadControlUploadMode.Advanced to enable Advanced Upload Mode. To access and customize the settings that relate to Advanced Upload Mode, use the ASPxUploadControl.AdvancedModeSettings property.

In this mode, the uploaded file is sent to the server in small packets (one at a time). The packets are saved into a temporary file, which has the .tmp extension, until upload is complete. You can use the UploadAdvancedModeSettings.TemporaryFolder property to specify the folder containing temporary files.

Note that files are deleted from the temporary folder in the following cases:

  • Once a file is uploaded.
  • After the pre-defined time has elapsed. This time period is defined by the UploadAdvancedModeSettings.UploadingExpirationTime property and is set to 6 hours (the default setting). Note that the file is removed only if the server has not been restarted during this time. If the server is rebooted during this time, the file will be removed in 6 days.

Advanced Upload Mode implementation is based on HTML5 technology. If HTML5 support is not available in an end-user browser, this mode uses Microsoft Silverlight technology. If HTML5 is not supported and Silverlight is not installed or is disabled, a message with a link to download Silverlight is displayed instead of ASPxUploadControl.

Advanced Upload Mode has the following benefits:

  • Uploading Large Files

  • Preventing Denial-of-Service (DoS) Attacks

  • Client-Side Validation

  • Progress Indication in Medium Trust

  • Multi-File Selection in File Open Dialog

Note

In Advanced Upload Mode, a file upload is not initiated automatically on the next postback.

Automatic Upload Mode Selection

Automatic Upload Mode selection is enabled if the ASPxUploadControl.UploadMode property is set to UploadControlUploadMode.Auto.

In this case, ASPxUploadControl uses HTML5 technology in Advanced Upload Mode. If it is unavailable, Silverlight technology is used in Advanced Upload Mode. If Silverlight is unavailable, the upload control works in Standard Upload Mode.