Skip to main content
Tab

UploadControlValidationSettings.AllowedFileExtensions Property

Gets or sets the allowed file extensions of the uploaded file.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

public virtual string[] AllowedFileExtensions { get; set; }

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 MVC Extensions UploadControlBinderSettings
.ValidationSettings .AllowedFileExtensions
UploadControlSettings
.ValidationSettings .AllowedFileExtensions
ASP.NET Web Forms Controls ASPxUploadControl
.ValidationSettings .AllowedFileExtensions

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.

ASPxUploadControl-AllowedFileExtensionsError

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.

ASPxUploadControl-FileExtensionFilter

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>
See Also