1

net and am just wondering if there is a method for the file upload tag in a library anywhere ?

Thanks guys heres my code

<asp:FileUpload ID="FileUpload1" runat="server" ForeColor="white" />
1
  • Dont forget to upvote and mark answer as accepted if you got the info you want Commented Feb 21, 2012 at 15:51

1 Answer 1

1

You and put one Upload Button and on click event of that button write code as below will do your task

Aspx page code

 <asp:FileUpload ID="fpManualCostActual" runat="server" />

   <asp:LinkButton ID="btnUpload" runat="server" OnClick="btnUpload_Click" 
              Upload</asp:LinkButton>

Cs file code

protected void btnUpload_Click(object sender, EventArgs e)
{
    try
    {
        if (fpManualCostActual.HasFile)
        {

                string filePath = Server.MapPath("~/Upload/" + 
                       SessionManager.UID.ToString() + "/MonthlyActual" + 
                       DateTime.Now.ToString("MMddyyyyHHmmss") + fileExt);
                fpManualCostActual.SaveAs(filePath);

        }
     }
    catch (Exception ex)
    {
        CustomException(ex, CommonHelper.ExceptionType.DBExceptionPolicy);
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.