I have an application that lets the use upload a pdf, I wanted to put a limit on the size the pdf can be. If the user tried to upload something too big I wanted to display a message to the user. I am trying to use a custom validator where it checks the size of the file and if it is too big it will set the "IsValid" to false. Is this the correct way to go about doing this? Is there a better way? When I test it, everything works in IE 8 and FF, but it does not work in IE 7 and can't figure out why.
Here is what I have so far, this is on my aspx page:
<td>Upload Board Book PDF:</td>
<td><asp:FileUpload runat="server" ID="PdfFileUpload" /></td>
<asp:RequiredFieldValidator runat="server" ControlToValidate="PdfFileUpload" ErrorMessage="*PDF is required" Display="Dynamic" ForeColor="Red" ValidationGroup="add" /><br />
<asp:CustomValidator ID="FileUploadCustomValidator" runat="server" ControlToValidate="PdfFileUpload"
OnServerValidate="FileUploadCustomValidator_ServerValidate" ErrorMessage="*File must be less then 20mb
View Complete Post