1.在FileUpload控件添加一个属性 webkitdirectory=""就可以上传文件夹了
<asp:FileUpload ID="FileUpload1" runat="server" webkitdirectory="" />
2.检测文件夹下所有子文件
string DirectoryName = FileUpload1.PostedFile.FileName; string path = Server.MapPath("/import/Import_image/" + DirectoryName); DirectoryInfo _dicinfo = new DirectoryInfo(path); FileInfo[] _files = _dicinfo.GetFiles("*", SearchOption.AllDirectories); //以下是处理方法
时间: 2024-10-15 12:26:22