Jquery Plugin - Stop upload if size too large

Archived from the Transloadit support forum. Originally posted on September 7, 2011; details may be outdated, see our docs for current behavior. Original thread

I’m trying to limit the size of the upload. This is a very rough version, but please let me know how I can better it.

Example for files under 10 megs

onProgress: function(bytesReceived, bytesExpected) {
            if(parseInt(bytesExpected) > 10500)
            {
                $('#progress').fadeOut();
                $('#MyForm').transloadit('cancel');
                $('#MyForm').transloadit('stop');
                alert('This upload exceeds the size limit');
            }
    
         }

Hi,

we have a ‘max_size’ parameter you can use:

http://transloadit.com/docs/authentication#more-authentication-options

Let me know if that works,
--fg