RadUpload for ASP.NET AJAX

RadControls for ASP.NET AJAX

In addition to the integrated validation, RadUpload lets you perform your own custom validation using the server-side ValidatingFile event. By using this event, you can use your own custom validation logic and override the integrated validation if needed.

To validate a file in the ValidatingFile event handler, set the IsValid property of the event arguments to true or false, in order to indicate whether the file is valid. Then set the SkipInternalValidation property of the event arguments to true to bypass the default validation on any files you have validated using the event handler.

As with integrated validation, valid files can be accessed using the UploadedFiles property and invalid files using the InvalidFiles property.

The following example illustrates using custom validation to bypass the integrated size validation for zip files. The rest of the uploaded files are validated against the declared maximum file size:

CopyASPX
<telerik:radupload id="RadUpload1" runat="server" maxfilesize="1000000" targetfolder="~/MyFiles"
    onvalidatingfile="RadUpload1_ValidatingFile"></telerik:radupload>
<asp:Button runat="server" ID="Button1" Text="Submit" />

 

Note

For an example of custom validation that checks the content of the uploaded file, see ValidatingFile.

See Also

Other Resources