Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restrict attaching big files using Javascript

How can we restrict users from attaching file bigger than specified size (to say 20MB). I do have a check at the server side to show errors in case of big files received on the server but that happens too late.

I want to achieve something like gmail, where you get a quick alert specifying

"This file exceeds the 25MB attachment limit. Sorry."

Thanks!

Pratik

like image 759
Pratik Garg Avatar asked Dec 30 '25 00:12

Pratik Garg


1 Answers

Javascript does not have access to this kind of information, but a tool like swfupload can give you nice javascript api's to access this information with flash.

http://swfupload.org/

like image 115
Alex Sexton Avatar answered Jan 01 '26 12:01

Alex Sexton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!