解决方法
HTML:
<asp:FileUpload ID="FileUpload1" onchange="selectFolder(event)" webkitdirectory mozdirectory msdirectory odirectory directory AllowMultiple="true" runat="server" />
要么
<input type="file" id="FileUpload" onchange="selectFolder(event)" webkitdirectory mozdirectory msdirectory odirectory directory multiple />
JavaScript的:
<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>