Skip to main content
Tab

ASPxUploadControl.FileName Property

OBSOLETE

Use the UploadedFiles[].FilesName property

Gets the uploaded file’s name.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

NuGet Package: DevExpress.Web

#Declaration

[Obsolete("Use the UploadedFiles[].FilesName property")]
public string FileName { get; }

#Property Value

Type Description
String

A String value specifying the file name.

#Remarks

You can use this property’s value to compose the UploadedFile.SaveAs method’s parameter value.

The FileName property contains the name of the uploaded file, but does not store the path to the file.

#Example

const string UploadDirectory = "~/UploadControl/UploadImages/";

protected void UploadControl_FileUploadComplete(object sender, FileUploadCompleteEventArgs e) {
     string resultExtension = Path.GetExtension(e.UploadedFile.FileName);
     string resultFileName = Path.ChangeExtension(Path.GetRandomFileName(), resultExtension);
     string resultFileUrl = UploadDirectory + resultFileName;
     string resultFilePath = MapPath(resultFileUrl);
     //Save the uploaded file
     e.UploadedFile.SaveAs(resultFilePath);
     string name = e.UploadedFile.FileName;
     string url = ResolveClientUrl(resultFileUrl);
     long sizeInKilobytes = e.UploadedFile.ContentLength / 1024;
     string sizeText = sizeInKilobytes.ToString() + " KB";
     e.CallbackData = name + "|" + url + "|" + sizeText;
}
See Also