PDA

View Full Version : How to check file size at client-side before uploading in Internet Explorer?



tanske
1 Sep 2011, 5:36 PM
Hi Guys,

Can anyone enlighten me if it is possible to do a client-side check of the file to be uploaded before the actual upload can be done?

To be achieved in Internet Explorer 7, without using ActiveX.

possible?

Uberdude
5 Sep 2011, 3:05 AM
I don't think you can do this in IE 7 (or even IE9) as it doesn't support the html5 file api. You can do it in recent Firefox and Chrome:


// fileUploadField is a Ext.ux.form.FileUploadField
var files = fileUploadField.fileInput.dom.files
if (files) {
// Browser supports html 5 file api
if (files[0].fileSize > 100 *1024 * 1024) {
// File over 100 MB! Do something...
}
}

tanske
6 Sep 2011, 7:39 PM
Thanks.

No HTML4 methods to support the my requirements?

I seem to be the only one in the whole world who has this problem. :s

Uberdude
7 Sep 2011, 12:47 AM
You could do it with Flash, but figured that was off limits as you said no ActiveX.