Upload چند فایل بطور هم زمان در ASP.NET 4.5
نویسنده: علیرضا اسمرام
تاریخ: ۱۳۹۱/۰۴/۳۱ ۰:۱۲
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
<input type="file" multiple="multiple" name="FileUpload1" id="FileUpload1" />
<asp:FileUpload ID="FileUpload1" runat="server" AllowMultiple="true" />
protected void Upload_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFiles)
{
string rootPath = Server.MapPath("~/App_Data/");
foreach (HttpPostedFile file in FileUpload1.PostedFiles)
{
file.SaveAs(Path.Combine(rootPath, file.FileName));
Label1.Text += String.Format("{0}<br />", file.FileName);
}
}
}