ErrorMessage="too large" ControlToValidate="FileUpload1" Display="Dynamic" />
Code Behind Page:
Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As ServerValidateEventArgs)
Dim filesize As Int64
filesize = FileUpload1.PostedFile.ContentLength
If (filesize > 5 * 1024) Then
args.IsValid = False
Label1.Text = "failed"
Return
Else
Label1.Text = "small size"
End If
End Sub