<asp:Label ID="Label1" runat="server" Text="Please select the file to upload"></asp:Label> <asp:FileUpload ID="FileUpload1" runat="server" /> <asp:Button ID="Button1" runat="server" Text="Upload" onclick="Button1_Click" />
protected void Button1_Click(object sender, EventArgs e) { Response.ContentType = "Application/msword"; //Get the physical path to the file. string FilePath = MapPath("BuildingDataAccessComponent.doc"); //Write the file directly to the HTTP content output stream. Response.WriteFile(FilePath); Response.End(); }
Response.AddHeader("content-disposition", "inline;filename=BuildingDataAccessComponent.doc");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)