Client-side size check error

Thread is closed for posting
5 posts, 1 answers
  1. Brad Docimo
    Brad Docimo avatar
    14 posts
    Member since:
    Aug 2008

    Posted 19 Aug 2008 Link to this post

    I am running the following example--no modifications--and it doesn't seem to work correctly:
    http://www.telerik.com/help/aspnet-ajax/upload_clientsideonclientprogressupdating.html


    When I upload small files, they upload fine, but files that exceed the limit are let through as well, and thus fail on postback.

    Any suggestions?

    Thanks

  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 20 Aug 2008 Link to this post

    Hello Brad,

    Please refer to this help article for details on how to validate the file size on the client.

    Sincerely yours,
    Paul
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Brad Docimo
    Brad Docimo avatar
    14 posts
    Member since:
    Aug 2008

    Posted 20 Aug 2008 Link to this post

    Thanks for the new link, but the script on that page is an exact copy of the one I used.  Any more suggestions?  I'm running the script completely unmodified, so it should be relatively easy to replicate:

    Latest release of RadControls (Q2-08), ASP.net 2.0 site, RadUpload with a ProgressTemplate

    Occasionally, I'm also receiving the following javaScript error, but not every time:
    'get_drogressData().RadUpload.RequestSize' is null or not an object

    Thanks,

    - Brad
  4. Brad Docimo
    Brad Docimo avatar
    14 posts
    Member since:
    Aug 2008

    Posted 20 Aug 2008 Link to this post

    Maybe it's just me, but I can't seem to get any client-side events to work.  I'm going to post my code.  Hopefully, that will help.

    Two errors:
    - The size check doesn't work, and gives a variety of errors as listed above
    - The cancel button says 'Object does not support this method' when clicked

            <script type="text/javascript">  
                 function onClientProgressBarUpdating(progressArea, args)  
                 {  
                   progressArea.updateHorizontalProgressBar(args.get_progressBarElement(), args.get_progressValue());  
                   args.set_cancel(true);  
                 }  
                 function checkUploadedFilesSize(progressArea, args)  
                 {  
                   //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";  
                     }  
                   }  
                 }  
                 function cancelUpload()  
                 {  
                   RadProgressArea1.cancelRequest();  
                 }  
            </script> 
            <telerik:RadProgressManager ID="RadProgressManager1" runat="server" />  
            <table cellpadding="0" cellspacing="0" border="0">  
                <tr>  
                    <td>  
                        <div id="divUploadPanel" style="width: 220px; height: 30px; overflow: hidden;">  
                            <telerik:RadUpload ID="RadUpload1" runat="server" ControlObjectsVisibility="None" InitialFileInputsCount="1" Skin="LightGreen" EnableEmbeddedSkins="False" />  
                        </div>  
                    </td>  
                    <td valign="middle" style="padding-top: 1px; padding-right: 10px;">  
                        <asp:LinkButton ID="btnUpload" CssClass="LinkButton" Height="19" runat="server">Upload File</asp:LinkButton>  
                    </td>  
                    <td style="padding-top: 5px;">  
                        <div id="divProgressPanel" style="width: 283px; height: 30px; overflow: hidden;">  
                            <telerik:RadProgressArea   
                              ID="RadProgressArea1"   
                              runat="server" 
                              OnClientProgressBarUpdating="onClientProgressBarUpdating" 
                              OnClientProgressUpdating ="checkUploadedFilesSize">  
                                 <ProgressTemplate>  
                                    <div style="background-image: url('/Intranet%20Local%20Copy/doc/images/interface-v2/BG-UploadBar-Off.gif');
                                                background-repeat: repeat-x;
                                                position: relative; 
                                                border: solid 1px #9A9A87; 
                                                height: 12px; 
                                                width: 200px;">  
                                       <div id="PrimaryProgressBarInnerDiv" 
                                         runat="server" 
                                         style="background-image: url('/Intranet%20Local%20Copy/doc/images/interface-v2/BG-UploadBar-On.gif');
                                                background-position: right top;
                                                background-color: #EAEADB; 
                                                height: 10px; 
                                                width: 100%;
                                                vertical-align: top; 
                                                position: relative;
                                                top: 1px;
                                                left: 0px; 
                                                z-index: 900;">  
                                                <!-- / -->  
                                       </div>  
                                     </div>  
                                     <span class="SmallCaptionText">  
                                            <span runat="server" id="PrimaryPercent">  
                                            </span>%&nbsp;of&nbsp;<span runat="server" id="PrimaryTotal">  
                                            </span>&nbsp;(<span runat="server" id="Speed"></span>)&nbsp;<a   
                                            href="javascript:cancelUpload();">Cancel</a>  
                                     </span>  
                                 </ProgressTemplate>  
                            </telerik:RadProgressArea>                  
                        </div>  
                    </td>  
                </tr>  
            </table>                   
     

    Thanks,

    - Brad
  5. Answer
    Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 25 Aug 2008 Link to this post

    Hello Brad Docimo,

    We are aware of the first problem - it will be fixed in the forthcoming service pack 1 in the middle of this week.
    About the second problem - I guess you mean this javascript method: cancelUpload

    You need to obtain the reference to the progress area first by:

    var area = $find("<%= RadProgressArea1.ClientID %>");
    area.cancelRequest();


    All the best,
    Veskoni
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top