• GoDaddy Community
  • VPS & Dedicated Servers
  • VPS & Dedicated Servers

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    New

    C# asp File Upload input

    I have an input type = "file" but when I click submit button, PostedFile.hasfile returns false but when it comes to my localhost it returns true. 

     

    Please help. I stuck into this problem for almost 1 week already. 

    1 REPLY 1
    New

    Re: C# asp File Upload input

    Please see my code below.

     

    protected void Button1_Click(object sender, EventArgs e)
    {
    if (FileUpload1.HasFile)
    {
    Page.ClientScript.RegisterClientScriptBlock(typeof(Page),
    "Alert", "alert('good')", true);
    }
    else
    {
    Page.ClientScript.RegisterClientScriptBlock(typeof(Page),
    "Alert", "alert('bad')", true);
    }
    }