|
Answer» Here is the html CODE of the webpage asp:FileUpload ID="FileUpload1" runat="SERVER" asp:Label ID="lblMessage" runat="server" Font-Bold="True" ForeColor="#0033CC" Visible="False"
Here is the code behind file protected void btnUpload_Click(OBJECT sender, EventArgs E) { if (FileUpload1.HasFile) { try { string filePath = Server.MapPath("./") + System.IO.Path.GetFileName(FileUpload1.FileName); FileUpload1.PostedFile.SaveAs(filePath); lblMessage.Text = "File UPLOADED to " + filePath; lblMessage.Visible = true; } catch (Exception ex) { throw ex; } } }
|