开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜