mvb*_*fst 7 html5 file-upload html5-filesystem
我试图找出浏览器是否有能力选择文件夹,而不仅仅是多个文件.目前的Chrome支持此功能(例如:http://html5-demos.appspot.com/static/html5storage/demos/upload_directory/index.html).
显然,它<input type="file" />具有webkitdirectory属性时可以在Chrome中使用.但是,我如何测试浏览器是否实际上能够选择文件夹并迭代文件?
twa*_*thr 10
也许这是解决您问题的方法:
function isInputDirSupported() {
var tmpInput = document.createElement('input');
if ('webkitdirectory' in tmpInput
|| 'mozdirectory' in tmpInput
|| 'odirectory' in tmpInput
|| 'msdirectory' in tmpInput
|| 'directory' in tmpInput) return true;
return false;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4994 次 |
| 最近记录: |