Occurs before the internal validation of every file in the
UploadedFiles collection.
Example
This example demostrates how to implement custom validation for specific file type.
Namespace: Telerik.WebControls
Assembly: RadUpload (in RadUpload.dll)
Syntax
Example
This example demostrates how to implement custom validation for specific file type.
| Visual Basic | Copy Code |
|---|
Private Sub RadUpload1_ValidatingFile(ByVal sender As Object, ByVal e As WebControls.ValidateFileEventArgs) Handles RadUpload1.ValidatingFile
If e.UploadedFile.GetExtension.ToLower = ".zip" Then
Dim maxZipFileSize As Integer = 10000000
If e.UploadedFile.ContentLength > maxZipFileSize Then
e.IsValid = False
End If
e.SkipInternalValidation = True
End If
End Sub
|
| C# | Copy Code |
|---|
private void RadUpload1_ValidatingFile(object sender, ValidateFileEventArgs e)
{
if (e.UploadedFile.GetExtension().ToLower() == ".zip")
{
int maxZipFileSize = 10000000; //~10MB
if (e.UploadedFile.ContentLength > maxZipFileSize)
{
e.IsValid = false;
}
//The zip files are not validated for file size, extension and content type
e.SkipInternalValidation = true;
}
}
|
Remarks
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also