Uploading File By Upload Controls?

Sabarimahesh
Posted by Sabarimahesh under ASP.NET category on | Points: 40 | Views : 1123
<form id="form1" runat="server" enctype="multipart/form-data">
<input type="file" id="up" name="up" />
<asp:Button runat="server" ID="bt_up" OnClick="bt_upClick" Text="UPLOAD" />
</form>


protected void bt_upClick(object sender, EventArgs e)
{
HttpPostedFile Flee= Request.Files["up"];
if (Flee!= null && Flee.ContentLength )
{
string Filename= Path.GetFileName(Flee.FileName);
file.SaveAs(Server.MapPath(Path.Combine("~/App_Data/", Filename)));
}
}

Comments or Responses

Login to post response