UploadControlValidationSettings.AllowedFileExtensions Property
Gets or sets the allowed file extensions of the uploaded file.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Property Value
Type | Description |
---|---|
String[] | An array of string values that contains the allowed file extensions. |
Property Paths
You can access this nested property as listed below:
Library | Object Type | Path to AllowedFileExtensions |
---|---|---|
ASP.NET Web Forms Controls | ASPxUploadControl |
|
ASP.NET MVC Extensions | UploadControlBinderSettings |
|
UploadControlSettings |
|
Remarks
Use the AllowedFileExtensions property to specify which file extensions are allowed for uploading. If the uploaded file’s extension is not allowed (it’s not listed by the AllowedFileExtensions property), the ASPxUploadControl‘s validation fails and the UploadControlValidationSettings.NotAllowedFileExtensionErrorText property’s value is displayed within the control’s specific error frame or alert box when the upload control operates in Standard or Advanced upload modes, respectively.
If the ASPxUploadControl validation fails, the FileUploadCompleteEventArgs.IsValid, ASPxUploadControl.IsValid and ASPxClientUploadControlFileUploadCompleteEventArgs.isValid properties are set to false
.
Note that the AllowedFileExtensions property is used only for validating the uploaded file extension. The AllowedFileExtensions property doesn’t allow you to customize the appearance of the File Extension filter in the Open File dialog window. The displayed list of file extensions within the File Extension filter depends on a browser and is controlled by it.
Members of an array provided by the AllowedFileExtensions property are standard file extensions which begin with a dot symbol (c# code) and are separated using commas (aspx code).
<dx:ASPxUploadControl runat="server">
<ValidationSettings AllowedFileExtensions=".jpg,.jpeg,.gif,.png" />
</dx:ASPxUploadControl>