Default.aspx
<div>
<input type="file" id="FileUpload1" multiple="multiple" runat="server" />
<asp:Button runat="server" ID="btnupload" Text="Upload" OnClick="btnupload_Click" /> <br/>
<asp:Label runat="server" ID="Label1"></asp:Label>
</div>
Default.aspx.cs
protected void btnupload_Click(object sender, EventArgs e)
{
string savepath = Server.MapPath("FolderName");
for (int i = 0; i < Request.Files.Count; i++)
{
HttpPostedFile hpf = Request.Files[i];
string filename = hpf.FileName;
hpf.SaveAs(savepath + @"\" + filename);
}
}
<div>
<input type="file" id="FileUpload1" multiple="multiple" runat="server" />
<asp:Button runat="server" ID="btnupload" Text="Upload" OnClick="btnupload_Click" /> <br/>
<asp:Label runat="server" ID="Label1"></asp:Label>
</div>
Default.aspx.cs
protected void btnupload_Click(object sender, EventArgs e)
{
string savepath = Server.MapPath("FolderName");
for (int i = 0; i < Request.Files.Count; i++)
{
HttpPostedFile hpf = Request.Files[i];
string filename = hpf.FileName;
hpf.SaveAs(savepath + @"\" + filename);
}
}
Comments
Post a Comment