简体   繁体   中英

Is there a reliable way to limit the size of a file upload via java servlet?

I'm running tomcat and Java EE. I am using apache's FileUpload library to handle file uploads. This is working great actually except when a user tries to upload a large file. There is a way to set a file limit using FileUpload but the entire request still goes through and the browser hangs the whole time. Is there a way to block large requests from even going through? Also is there a way to check file size client side so I can cut off most requests before they start?

How about using a Jquery fileupload plugin

https://github.com/blueimp/jQuery-File-Upload

This allows you to limit the size at the client side and prevent upload before it leaves the client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM