Cross-browser checking on file size at client side before uploading it to the server?

后端 未结 2 456
日久生厌
日久生厌 2020-12-20 22:40

Client side validation is important to improve usability.

Is there any cross-browser way to validate the file size before uploading it to the server. I am using asp

2条回答
  •  囚心锁ツ
    2020-12-20 23:42

    This is now possible with HTML5's File API:

    
    

    This is supported by most of the latest browsers.

    Internet Explorer supports this workaround involving ActiveX, but it requires lowering Internet Explorer's security settings, so it isn't really an option for most applications.

    It takes more work, but use a Flash-based uploader such as SWFUpload if you really need to do this in IE9 or below. IE10 will (hopefully) add support for the HTML5 File API.

提交回复
热议问题