File Download
- 2 minutes to read
You can provide end-users with the ability to download files selected within the ASPxFileManager. To enable this functionality, set the FileManagerSettingsEditing.AllowDownload property to true.
Temporary File Folder
When multiple file selection is enabled (the FileManagerSettings.EnableMultiSelect property is set to true), ASPxFileManager saves each downloaded file into a temporary file. The file name can be specified by the FileManagerSettingsEditing.DownloadedArchiveName property within a specific server folder. You can specify this folder using the FileManagerSettingsEditing.TemporaryFolder property (“~/FileManagerTemp” by default). Ensure that the ASP.NET application has ‘write’ access to the folder on the server.
Download Initiation
A file download can be initiated in the following manner.
Via a user interface.
Clicking the specific download button, or the Download context menu item initiates a download of the selected files.
Programmatically.
To download a file, call the ASPxClientFileManagerFile.Download client method of the object that represents the file.
ASPxClientFileManager1.GetSelectedFile().Download();
File Processing
ASPxFileManager allows you to process the downloaded file and cancel the file download if required. You can respond to the initiated file download operation in the following manner.
- On the Client-Side - Handle the ASPxClientFileManager.FileDownloading client event.
- On the Server-Side - Handle the ASPxFileManager.FileDownloading server event.
For instance, you can use a server-side event to add a watermark to downloaded image files.