Back to Devexpress

Upload Modes

aspnetbootstrap-118605-data-editors-upload-control-upload-modes.md

latest4.4 KB
Original Source

Upload Modes

  • Nov 14, 2024
  • 5 minutes to read

The BootstrapUploadControl provides the capability to choose from two upload modes ( Standard and Advanced ), which can be specified using the ASPxUploadControl.UploadMode property. You can also set the property to Auto to select the upload mode automatically.

Standard Upload Mode

Setting the ASPxUploadControl.UploadMode property to UploadControlUploadMode.Standard enables the Standard Upload Mode. This is a standard FileUpload-based mode in which the uploaded 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 (1GB+). The ASP.NET worker process has a virtual address space of 2GB. However, it only uses a little more than 1 GB because of ASP.NET health monitoring and memory fragmentation.

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

You need to increase the Request length limit (using the Web.Config file’s MaxRequestLength, which does not protect against denial-of-service (DoS) attacks caused by users who post large files to the server, to allow large file uploads in this mode.

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 the Advanced Upload Mode. You can access and customize the settings that relate to the Advanced Upload Mode using the BootstrapUploadControl.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 .tmp file until the upload is complete. You can use the UploadAdvancedModeSettings.TemporaryFolder property to specify the folder for temporary files.

Note that files are deleted from this folder in the following cases.

  • Once a file is uploaded.
  • After the pre-defined time has elapsed (normally twenty minutes).

The file might also be removed if the server shuts down using the stop command. If the server shuts down abnormally, the temporary file is not removed. However, it is removed later when the server is restarts.

The Advanced Upload Mode implementation is based on HTML5 technology and 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

Important

The ASPxUploadControl.FileUploadComplete event is not raised for individual files if multiple files are uploaded in the Advanced mode.

Automatic Upload Mode Selection

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

In this case, the Upload Control uses the HTML5 technology (Advanced Upload Mode). If it is unavailable, the upload control works in the Standard Upload Mode.