Hello ,
Friends Now I am going to describe how to save uploaded file in the folder of
Solution Exploer.
Please
follow these steps.
Step-1:
Create a
.aspx file of web application and design like this and follow up the following
code.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body style="width: 285px">
<form id="form1" runat="server">
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Summit" />
<br />
<asp:Label ID="lblupload" runat="server" ForeColor="#FF33CC"></asp:Label>
</div>
</form>
</body>
</html>
Go to
Solution Exploer rightclick over your project
then select Add option then select New Folder and rename it.Please follow
according to following snapshot.
Step-3:
After create
a folder go to your design page(.aspx) and double click over Summit button and
Write the
following code.
protected void Button1_Click(object sender, EventArgs e)
{
FileUpload1.SaveAs(Server.MapPath("rabi\\" +
FileUpload1.FileName));
lblupload.Text = "Thanks...Your File Uploaded Sucessfully...";
}
Step-4:
Thanks Rabi
No comments:
Post a Comment