这个元素,
<asp:FileUpload ID="FileUploadEventosCasal" runat="server" />
可以按时间上传一个文件(按钮单击)。
我想知道如何一键上传多个文件(排队)。我不能使用 .net 4.5。我想要这样的例子:http ://www.aspdotnet-suresh.com/2012/12/aspnet-upload-multiple-files-using.html为了使它工作,我做了这些改变:
<script src="js/jquery-1.8.2.js"></script>
<script>$(function () {/* jquery.MultiFile.js code pasted here */});</script>
<asp:FileUpload ID="FileUploadEventosCasal" CssClass:"multi" runat="server" />
但这种变化只是为了运行。当我尝试上传时,它不起作用。这是按钮事件:
protected void ButtonInsMultipleUpload_Click(object sender, EventArgs e)
{
HttpFileCollection fileCollection = Request.Files;
List<byte[]> imgs = new List<byte[]>();
for (int i = 0; i < fileCollection.Count; i++)
{
HttpPostedFile uploadfile = fileCollection[i];
imgs.Add(new byte[uploadfile.InputStream.Length]);
uploadfile.InputStream.Read(imgs[i], 0, imgs[i].Length);
}
}