Combined max file size validation?

Thread is closed for posting
6 posts, 0 answers
  1. Adam L. Ooten
    Adam L. Ooten avatar
    86 posts
    Member since:
    Sep 2005

    Posted 29 Dec 2010 Link to this post

    We have a page with a RadUpload and RadProgressArea where users can upload multiple files up to a combined maximum file size of 150MB.  Is there a way to validate the size of the combined files being uploaded and prevent the page just crashing out with the "Maximum request length exceeded." error?  The MaxFileSize property seems to be on the right track but only works on a per item basis instead of on the whole transaction.
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 03 Jan 2011 Link to this post

    Hello Adam L. Ooten,

    I suggest that you try the approach shown here.

    Kind regards,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam L. Ooten
    Adam L. Ooten avatar
    86 posts
    Member since:
    Sep 2005

    Posted 03 Jan 2011 Link to this post

    Hello Genady,

     

    I have tried that approach using the following code:

    function checkUploadedFilesSize(progressArea, args) {
      if (!progressArea.confirmed && args.get_progressData().RadUpload.RequestSize > 160000000) {
        progressArea.cancelRequest();
        alert("The total size of the selected files is more than the limit.")
        }
    }
      
    <telerik:RadUpload ID="rduDoc" runat="server" MaxFileInputsCount="0" FocusOnLoad="true"                                ReadOnlyFileInputs="true" OnClientAdded="addTitle" ControlObjectsVisibility="RemoveButtons, AddButton"
     InitialFileInputsCount="1" EnableFileInputSkinning="True" Skin="Vista"> </telerik:RadUpload>
      
    <telerik:RadProgressManager ID="RadProgressManager1" runat="server" />
      
    <telerik:RadProgressArea ID="RadProgressArea1" runat="server" ProgressIndicators="TotalProgressBar, TotalProgress, TotalProgressPercent, RequestSize, SelectedFilesCount, CurrentFileName" OnClientProgressUpdating="checkUploadedFilesSize" ><Localization Uploaded="Uploaded" /></telerik:RadProgressArea>

    However, this approach would randomly generate the error message making it impossible to debug. In addition, the upload cancel request was never actually canceled. It would still throw the request length exception.

     

    In order to help debug, we also tried the following JavaScript to debug:

    function checkUploadedFilesSize(progressArea, args) {
      alert(args.get_progressData().RadUpload.RequestSize)
    }

    This failed to work at all. No request size was displayed. As we are not seeing the expected results, is this the only available solution that we can use?


  5. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 07 Jan 2011 Link to this post

    Hi Adam L. Ooten,

    We are currently preparing a KB article that shows how to implement a combined size validation on a target folder using RadAsyncUpload, the article is going to be released together with the upcoming Service Pack 2 release.

    Apart from this, I've just tested your code and it works fine. You can find a link to a short video, showing it working, here. What are the random errors that you get? Can you please screenshot it so that we can take a look.

    Alternatively, you could try using RadAsyncUpload instead of RadUpload since the former provides out of the box client-side size validation. You can check it out in this demo.

    Kind regards,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  6. Adam L. Ooten
    Adam L. Ooten avatar
    86 posts
    Member since:
    Sep 2005

    Posted 07 Jan 2011 Link to this post

    I do not think your second link to a demo you posted is entirely correct...  Can you check that and let me know what demo you were referring to? :)
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 10 Jan 2011 Link to this post

    Hello Adam,

    We're sorry for this - here is the correct link.

    Best wishes,
    Yana
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017