Hello Friends....
Welcome to this Blog...This Blog is specially for the .Net Developers where all developers can discuss the .Net and Sql Articles.
"And will you succeed? Yes! You will indeed!(98 and 3/4 percent guaranteed)."

Friday, September 3, 2010

Create File Uploader (Visual Studio)

By this Coding you can create File Uploader 
and the is file will uploaded into Foder:- 
 Design Source Code:- 
<form id="form1" runat="server">
    <asp:FileUpload id="FileUploadControl" runat="server" />
    <asp:Button runat="server" id="UploadButton" text="Upload" 
     onclick="UploadButton_Click" />
    <br /><br />
    <asp:Label runat="server" id="StatusLabel" text="Upload 
     status: " />
Coding C#:
protected void UploadButton_Click(object sender, EventArgs e)
string filename = Path.GetFileName(FileUploadControl.FileName);
FileUploadControl.SaveAs(Server.MapPath("~/Folderpath") + filename);
StatusLabel.Text = "Upload status: File uploaded!";
catch(Exception ex)
StatusLabel.Text = "Upload status: The file could not be uploaded.
The following error occured: " + ex.Message;