I tried to use the approaches on your document at http://www.telerik.com/help/aspnet-ajax/upload_howtoclientfilesize.html but couldn't make the code work!
I want to check the file size on the client (I want to limit the upload to 5 MB) but the javascript function cannot even be called (I place an alert code and nothing happens)
Could you please advise me what to do?
Here are excerpts from my code:
| <table cellpadding="0" cellspacing="0"> |
| <tr> |
| <td align="left" valign="top"> |
| <telerik:RadUpload ID="ruAttachment" runat="server" OverwriteExistingFiles="True" |
| AllowedFileExtensions=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.pdf,.mov,.wmv,.mpg,.avi,.wma,.mp3,.jpg,.gif,.png,.bmp" |
| Width="300px" MaxFileInputsCount="1" ReadOnlyFileInputs="True" ControlObjectsVisibility="None" |
| EnableEmbeddedSkins="False" Skin="Vinsume" MaxFileSize="2147483647" /> |
| <telerik:RadProgressArea runat="server" ID="rpaAttachment" OnClientProgressUpdating="checkUploadedFilesSize" |
| Language=""> |
| <Localization Uploaded="Uploaded"></Localization> |
| </telerik:RadProgressArea> |
| <telerik:RadProgressManager runat="server" ID="rpmAttachment" /> |
| </td> |
| </tr> |
| </table> |
| <script language="javascript" type="text/javascript"> |
| function checkUploadedFilesSize(progressArea, args) { |
| alert("fgdfgdf"); |
| //progressArea.confirmed is a custom variable, |
| // you can use another if you want to |
| if (!progressArea.confirmed && |
| args.get_progressData().RadUpload.RequestSize > 1000000) { |
| if (confirm("The total size of the selected files" + |
| " is more than the limit." + |
| " Do you want to cancel the upload?")) { |
| progressArea.cancelRequest(); |
| } |
| else { |
| progressArea.confirmed = "confirmed"; |
| } |
| } |
| } |
| </script> |