aspnet-devexpress-dot-web-dot-filemanagerfileuploadeventargs.md
Gets a file, related to the event.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public FileManagerFile File { get; }
Public ReadOnly Property File As FileManagerFile
| Type | Description |
|---|---|
| FileManagerFile |
A FileManagerFile object that represents a file currently being uploaded.
|
Within the ASPxFileManager.FileUploading event’s handler, the currently processed file can be accessed by using the File property.
The code below allows end-users to upload only mp3 files to the “Music mp3” folder.
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";
}
}
<dx:ASPxFileManager ID="ASPxFileManager1" runat="server" OnFileUploading="ASPxFileManager1_FileUploading">
<Settings RootFolder="~/Content/FileManager/Files" ThumbnailFolder="~\Thumb" />
</dx:ASPxFileManager>
See Also
FileManagerFileUploadEventArgs Class