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
精彩评论