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

File Size Limits

4 Answers 224 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Donna
Top achievements
Rank 1
Donna asked on 17 Jun 2008, 05:39 PM
Hi,

I am evaluating the RadUpload control for purchase. I have a requirement to do the following:

1. Don't allow the user to upload any file that exceeds a certain size.
2. Don't allow the user to upload any file that will exceed the available storage that they have left on the server.

For example, let's assume that there is a limit of 15 MB per individual file, and the user has 20 MB of room left on the server. The user has selected three files to be uploaded. The first is 18MB, the second is 10MB, and the third is 12MB.
What I want is for the first file to not be uploaded (because it is over the individual file size limit of 15MB), the second file to upload successfully, and the third file to not be uploaded (because the user now only has 10MB of server space left after the second file was uploaded).

Can this be done with the RadUpload control?

Thx.

4 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 18 Jun 2008, 01:15 PM
Hi Donna,

Straight to your points:

1) You can easily achieve your goal using the MaxFileSize property of the control. For details on the matter please refer to this help article.

2) Unfortunately, this functionality is out of the scope of the control. You will have to code that logic by yourself.

Sincerely yours,
Paul
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Donna
Top achievements
Rank 1
answered on 18 Jun 2008, 08:19 PM
Hi,

Thanks for your response.

I just tried using MaxFileSize property and it doesn't look like it is being checked until the file has already been uploaded. This would be a big problem for large file uploads. Is this a limitation of the control or is there another way to do it such that the file size is checked when/before the upload starts?

Also, is there anyway to get the size of the currently uploading file? I know that you can use RadUpload.RequestSize, but the documentation says that this value is the combined file size, whereas I need the size of the currently uploading file so that I can compare it to the storage space remaining.

Thx.
0
Paul
Telerik team
answered on 19 Jun 2008, 09:19 AM
Hi Donna,

For details on the matter please refer to this help article.

All the best,
Paul
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Basel Nimer
Top achievements
Rank 2
answered on 29 Oct 2009, 04:33 PM
Hello,
Am sorry i am posting to an old post, but i have exactly the same problem.

the problem with the code:
<script type="text/javascript"
 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"
     } 
   } 
 } 
</script> 
<telerik:RadUpload runat="server" id="RadUpload1" /> 
<telerik:RadProgressArea runat="server" id="RadProgressArea1" 
 OnClientProgressUpdating ="checkUploadedFilesSize" /> 
<telerik:RadProgressManager runat="server" id="RadProgressManager1" /> 
<asp:Button runat="server" id="Button1" text="Upload" /> 

is that the size retrieved by RequestSize is the total size of all uploaded files, How can i check this for each file?

i might for example have 5 uploads, and the maximum size for any of the files should be 1 MB. i need to do this without uploading the files!!!

Thanks for your help.
Tags
Upload (Obsolete)
Asked by
Donna
Top achievements
Rank 1
Answers by
Paul
Telerik team
Donna
Top achievements
Rank 1
Basel Nimer
Top achievements
Rank 2
Share this question
or