Back to Devexpress

FileManagerFileUploadEventArgs.File Property

aspnet-devexpress-dot-web-dot-filemanagerfileuploadeventargs.md

latest2.0 KB
Original Source

FileManagerFileUploadEventArgs.File Property

Gets a file, related to the event.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public FileManagerFile File { get; }
vb
Public ReadOnly Property File As FileManagerFile

Property Value

TypeDescription
FileManagerFile

A FileManagerFile object that represents a file currently being uploaded.

|

Remarks

Within the ASPxFileManager.FileUploading event’s handler, the currently processed file can be accessed by using the File property.

Example

The code below allows end-users to upload only mp3 files to the “Music mp3” folder.

csharp
protected void ASPxFileManager1_FileUploading(object source, DevExpress.Web.FileManagerFileUploadEventArgs e) {
      if (e.File.Folder.FullName == "Files\\Music mp3")
            if (e.File.Extension != ".mp3") {
                e.Cancel = true;
                e.ErrorText = "You can only upload mp3 files to this folder";
            }
}
aspx
<dx:ASPxFileManager ID="ASPxFileManager1" runat="server" OnFileUploading="ASPxFileManager1_FileUploading">
            <Settings RootFolder="~/Content/FileManager/Files" ThumbnailFolder="~\Thumb" />
</dx:ASPxFileManager>

See Also

FileManagerFileUploadEventArgs Class

FileManagerFileUploadEventArgs Members

DevExpress.Web Namespace