开发者

HTML <input type="file"... check filesize with Flash

开发者 https://www.devze.com 2023-01-03 11:50 出处:网络
I\'d like to know how to use the JavaScript onChange event on <input type=\"file\"...so that when a user selected files, onChange will call Flash开发者_如何转开发 to return the file\'s size and dec

I'd like to know how to use the JavaScript onChange event on <input type="file"... so that when a user selected files, onChange will call Flash开发者_如何转开发 to return the file's size and decide what to do next.

2nd. How to use JavaScript to exclude this check, if the browser doesn't have Flash.


You can use a part of FancyUpload project - http://digitarald.de/project/fancyupload/. This control has a good documentation. Alternatively I use the client ActiveX

var objFileSystem = new ActiveXObject("Scripting.FileSystemObject");
var strFilename = document.upload.file.value;
var resFile = objFileSystem.getFile(strFilename);
var intSize = resFile.size;

Check the Cross Browser Flash Detection in Javascript for 2nd issue

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号