我想要选择特定路径文件夹来保存文件。 为此,我想点击但是 n,它应显示文件夹选择选项。
答案 0 :(得分:1)
HTML:
<input type="file" id="FileUpload" onchange="selectFolder(event)" webkitdirectory mozdirectory msdirectory odirectory directory multiple />
JS:
<script type="text/javascript">
function selectFolder(e) {
var theFiles = e.target.files;
var relativePath = theFiles[0].webkitRelativePath;
var folder = relativePath.split("/");
alert(folder[0]);
}
</script>