This is a migrated thread and some comments may be shown as answers.

Client size check problem - OnClientProgressUpdating is not called!

1 Answer 56 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Mehmet Ali Ozenci
Top achievements
Rank 1
Mehmet Ali Ozenci asked on 25 Aug 2009, 07:41 AM
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> 
 

1 Answer, 1 is accepted

Sort by
0
Mehmet Ali Ozenci
Top achievements
Rank 1
answered on 25 Aug 2009, 08:20 AM
OK now everything seems fine. I just had to add the corresponding maxallowedcontentlength property to the web.config to be used by IIS7 :)
Tags
Upload (Obsolete)
Asked by
Mehmet Ali Ozenci
Top achievements
Rank 1
Answers by
Mehmet Ali Ozenci
Top achievements
Rank 1
Share this question
or