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.v25.2.dll

NuGet Package: DevExpress.Web

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 file extensions that users can upload. If the uploaded file’s extension is not allowed (not listed by the AllowedFileExtensions property), the ASPxUploadControl validation fails. The control displays the UploadControlValidationSettings.NotAllowedFileExtensionErrorText within an error frame in Standard upload mode or an alert box in Advanced upload mode.

ASPxUploadControl-AllowedFileExtensionsError

If the ASPxUploadControl validation fails, the FileUploadCompleteEventArgs.IsValid, UploadedFile.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