You cannot check before it is uploaded. If you use apache or nginx, then 
can check and block large uploads, but you would get a web server error, 
not a web2py error.


On Sunday, 26 January 2014 13:32:16 UTC-6, lesssugar wrote:
>
> I'm using IS_LENGTH in my model to validate file size of uploaded image:
>
> IS_LENGTH(2097152, 1, error_message='Max image size: 2MB')
>
> However, the size is being checked after the file's been uploaded, which 
> is not very user friendly when it comes to files larger than 2MB. How can I 
> first validate the file size and then - if it's lower than 2MB - proceed 
> with upload? Can it be done with Python or do I need JS for this?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to