上传多个文件 [英] Upload multiple files
本文介绍了上传多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试上传多个文件..如果用户可以上传1个文件,那么他们可以使用提交按钮,但如果用户想要上传多个文件,那么他们应该点击上传更多文件然后下一个文件上传将显示如何我这样做..我想separtely上传文件..不想一次选择倍数这是我尝试的
我尝试过:
I am trying to upload multiple files.. if user may upload 1 file then they may b go with submit button but if user wants to upload multiples files then they should click on upload more files and then next fileupload will be display how i do this.. i want to upload file separtely .. not want to select multiples at a time this is what i try
What I have tried:
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:LinkButton ID="LinkButton1" runat="server">upload multiple files</asp:LinkButton>
<br />
<asp:Button ID="Button1" runat="server" Text="upload" OnClick="Button1_Click" />
<br />
<asp:Label ID="Span1" runat="server"></asp:Label>
</div>
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFiles)
{
foreach (HttpPostedFile uploadedFile in FileUpload1.PostedFiles)
{
uploadedFile.SaveAs(System.IO.Path.Combine(Server.MapPath("~/Images/"),
uploadedFile.FileName));
Span1.Text += String.Format("{0}<br />", uploadedFile.FileName);
}
}
推荐答案
下面的文章解决了同样的问题:
使用jQuery上传多个文件ASP.Net 4.5中的通用处理程序 [ ^ ]
Below article is solving same issue:
Uploading Multiple Files Using jQuery and Generic Handler in ASP.Net 4.5[^]
这篇关于上传多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文