Skip to main content
Tab

UploadControlValidationSettings.MaxFileSizeErrorText Property

Gets or sets the error text indicating that the uploaded file’s size exceeds the maximum allowed value.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v22.1.dll

Declaration

[DefaultValue("File size exceeds the maximum allowed size, which is {0} bytes")]
public string MaxFileSizeErrorText { get; set; }

Property Value

Type Default Description
String "File size exceeds the maximum allowed size, which is {0} bytes"

A String value that specifies the error text.

Property Paths

You can access this nested property as listed below:

Show 33 property paths
Library Object Type Path to MaxFileSizeErrorText
ASP.NET Bootstrap Controls BootstrapBinaryImageUploadSettings
.UploadValidationSettings.MaxFileSizeErrorText
BootstrapFileManagerSettingsUpload
.ValidationSettings.MaxFileSizeErrorText
BootstrapUploadControl
.ValidationSettings.MaxFileSizeErrorText
ASP.NET Web Forms Controls ASPxHtmlEditorAudioUploadSettings
.ValidationSettings.MaxFileSizeErrorText
ASPxHtmlEditorFlashUploadSettings
.ValidationSettings.MaxFileSizeErrorText
ASPxHtmlEditorImageUploadSettings
.ValidationSettings.MaxFileSizeErrorText
ASPxHtmlEditorUploadControl
.ValidationSettings.MaxFileSizeErrorText
ASPxHtmlEditorVideoUploadSettings
.ValidationSettings.MaxFileSizeErrorText
HtmlEditorAudioSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
HtmlEditorDocumentSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
HtmlEditorFileManagerUploadSettings
.ValidationSettings.MaxFileSizeErrorText
HtmlEditorFlashSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
HtmlEditorImageSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
HtmlEditorVideoSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
RichEditDocumentSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
SpreadsheetFileManagerUploadSettings
.ValidationSettings.MaxFileSizeErrorText
ASPxUploadControl
.ValidationSettings.MaxFileSizeErrorText
BinaryImageUploadSettings
.UploadValidationSettings.MaxFileSizeErrorText
FileManagerSettingsUpload
.ValidationSettings.MaxFileSizeErrorText
ASP.NET MVC Extensions UploadControlBinderSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxFileManagerSettingsUpload
.ValidationSettings.MaxFileSizeErrorText
MVCxHtmlEditorAudioSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxHtmlEditorAudioUploadSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxHtmlEditorDocumentSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxHtmlEditorFileManagerUploadSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxHtmlEditorFlashSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxHtmlEditorFlashUploadSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxHtmlEditorImageSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxHtmlEditorImageUploadSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxHtmlEditorVideoSelectorUploadSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxHtmlEditorVideoUploadSettings
.ValidationSettings.MaxFileSizeErrorText
MVCxUploadControl
.ValidationSettings.MaxFileSizeErrorText
UploadControlSettings
.ValidationSettings.MaxFileSizeErrorText

Remarks

The error text is displayed within the ASPxUploadControl‘s specific error frame, if the uploaded file’s size exceeds the value defined by the UploadControlValidationSettings.MaxFileSize property.

Example

The following sample code demonstrates how to save the file specified within the ASPxUploadControl on the client. Before file saving, the FileUploadCompleteEventArgs.IsValid property is tested to verify whether the file passes the validation criteria defined via the ASPxUploadControl.ValidationSettings property. Note, that in order to compose the ASPxUploadControl.SaveAs method’s parameter value, the HostingEnvironment.MapPath(String) method and ASPxUploadControl.FileName property are used to specify the web application’s Image folder as a location where the file should be saved, and define the file’s name, respectively.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.1.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxUploadControl" TagPrefix="dxuc" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Page_Load(object sender, EventArgs e){
    }
protected void ASPxUploadControl1_FileUploadComplete(object sender, 
DevExpress.Web.FileUploadCompleteEventArgs e) {
        if (e.IsValid) {
            ASPxUploadControl1.SaveAs(MapPath("Images/" + ASPxUploadControl1.FileName));
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>How to use the ASPxUploadControl's Validation Settings</title>
</head>
<body>
    <form id="form2" runat="server">
        <dxuc:ASPxUploadControl 
            ID="ASPxUploadControl1" 
            runat="server" 
            OnFileUploadComplete="ASPxUploadControl1_FileUploadComplete">
            <ValidationSettings 
                AllowedFileExtensions=".txt,.jpg,.jpe,.jpeg,.doc" 
                MaxFileSize="1000000" 
                FileDoesNotExistErrorText="This file can't be found." 
                GeneralErrorText="Custom file uploading fails due to an external error that 
                    doesn't relate to the ASPxUploadControl's functionality" 
                MaxFileSizeErrorText="Size of the uploaded file exceeds maximum file size" 
                NotAllowedContentTypeErrorText="The uploaded file's content type isn't allowed">
                <ErrorStyle BackColor="Yellow" ForeColor="Black" />
            </ValidationSettings>
        </dxuc:ASPxUploadControl>

    </form>
</body>
</html>
See Also