File size limit possible?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

File size limit possible?

Rainer
Hello,
I am trying to limit the size of a single file, not the complete request.

I have a website with five neat-upload-controls (single file, not multi file) and a progress bar. The idea is that all files togesther must not increase 20 MByte - which is easy and works good - but also each file should not be larger than 5 MByte. For this I cannot find a solution.

In the code behinde I do have the fileContent.length property, which I could use to abort the upload. But I am not sure how to do that.

Atually the best way would be, if I could just exclude the file which ist to big from the upload and save all other files. But it would also be fine if I can abort the whole upload process, as long as I can give a proper message to the user.

Is there a possibility to do that?

Thanks,
Rainer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: File size limit possible?

Dean Brettle
Administrator
The most user-friendly solution is to use a single MultiFile control with useFlashIfAvailable="true" and limit the the number/size of files by Customizing MultiFile's Handling of Queued Files.  That will work for all Flash users.  For non-Flash users you could examine multiFile.Files.Length and multiFile.Files[i].ContentLength in your code-behind.  Those non-Flash users will not find out that their files are too large or numerous until after the upload completes but there is no way for JavaScript to determine the size of individual files without using Flash anyway, so there isn't a better solution.


Loading...