Archived from the Transloadit support forum. Originally posted on December 24, 2011; details may be outdated, see our docs for current behavior. Original thread
Hi
I would like to implement the max_size option in my upload form, but cannot make this feature work. I would like the user to be stopped from uploading the whole video before being stopped, and told that the file is too large.
Can you provide a quick example of the hidden fields in which this should appear in the html/php form?
in your hidden “params” input field you provide json in the form of
{ auth: {},
template_id: ‘test’
}
etc. In the “auth” portion, add “max_size: [[value]]” where [[value]] is a value representing the number of bytes you want to allow. So if you want to allow 50MB files, then the value would be 50 * 1024 * 1024.
On my site each user has a variable $upload_limit associated with their profile (eg. $upload_limit = 1000000;), and this will vary per user type. Is it possible to pass this variable into ‘max_size’ in order to differentiate allowed maximum file uploads?
well you pass the value into your hidden form input field. So if you have any server side scripting language available (like php), you can calculate the passed value in php depending on the logged in user.