CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Conditional abort of upload?

by kmccoy » 16 Sep 2013 18:00

Hi!

I want to limit the total size of all files uploaded by a user to 5 megabytes. How can I stop the JQFileUpload component from uploading a file, if I know that it would exceed the user's quota?

Example: The user has already uploaded 4.5 MB and then tries to upload a 1 MB file: abort. If the user has 4.5 MB uploaded and then uploads another 20 KB then do not abort.

I know how to get the current total size of all files uploaded, but I need to know how to abort an upload in one of the event handlers for this component.
Best Regards,

Kevin G. McCoy
kmccoy
 
Posts: 90
Joined: 08 Oct 2012 13:01

by Jorge Sousa » 16 Sep 2013 18:15

Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by kmccoy » 16 Sep 2013 18:17

cgdevtools_support wrote:Have you tried with JQUploadOptions.SizeLimit?


This will not work for me, since I need to limit the total size of all files uploaded in a session - not just a single file.

I don't want people uploading gigabytes of files, one 5-Megabyte file at a time.
Best Regards,

Kevin G. McCoy
kmccoy
 
Posts: 90
Joined: 08 Oct 2012 13:01

by Jorge Sousa » 16 Sep 2013 18:45

Hi again

You can use Upload.JQUploadOptions.OnComplete

Check Upload.FileNames file sizes, to eventually show an error message and disable future uploads.

Best Regards
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to JQFileUpload

cron

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.