Add a file browse HTML control. Right click and select 'Run as Server Control'. Add a button. So you have something like this:
<input type="file" runat="server" ID="File1" /><asp:Button runat="server" ID="Button1" />
Double click the button and add the following code.
private void Button1_Click(object sender, System.EventArgs e)
{
string strFilename;
try
{
strFilename = File1.PostedFile.FileName;
strFilename = System.IO.Path.GetFileName(strFilename);
File1.PostedFile.SaveAs(@"f:\"+strFilename);
}
catch(Exception ex)
{
Response.Write(ex);
}
}
Comments