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

Combined max file size validation?

5 Answers 154 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Adam L. Ooten
Top achievements
Rank 2
Adam L. Ooten asked on 29 Dec 2010, 04:53 PM
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.

5 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 03 Jan 2011, 03:07 PM
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.
0
Adam L. Ooten
Top achievements
Rank 2
answered on 03 Jan 2011, 07:08 PM

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?


0
Genady Sergeev
Telerik team
answered on 07 Jan 2011, 12:37 PM
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.
0
Adam L. Ooten
Top achievements
Rank 2
answered on 07 Jan 2011, 05:43 PM
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? :)
0
Yana
Telerik team
answered on 10 Jan 2011, 05:23 PM
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.
Tags
Upload (Obsolete)
Asked by
Adam L. Ooten
Top achievements
Rank 2
Answers by
Genady Sergeev
Telerik team
Adam L. Ooten
Top achievements
Rank 2
Yana
Telerik team
Share this question
or