FileUpload.hasFile is always False

Total Post:101

Points:709
 7557  View(s)
Ratings:
Rate this:

I have a FileUpload control (and it's not inside an UpdatePanel) and its hasFile property is always False.

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

  1. Post:378

    Points:2694
    Re: FileUpload.hasFile is always False

    Hi Pravesh, 

    try this:

    <input id="filMyFile" type="file" runat="server"></input>

    In code save file to server:

    HttpPostedFile myFile = filMyFile.PostedFile;           
    string fullPath=Server.MapPath("~/UploadDocuments/") + myFile.FileName;
    myFile.SaveAs(fullPath);

      Modified On Apr-05-2018 05:51:57 AM
  1. Post:119

    Points:835
    Re: FileUpload.hasFile is always False

    <input id="filMyFile" type="file" runat="server"></input>

    In code save file to server:

    HttpPostedFile myFile = filMyFile.PostedFile;           
    string fullPath=Server.MapPath("~/UploadDocuments/") + myFile.FileName;
    myFile.SaveAs(fullPath);


    Hope this will solve your problem

      Modified On Apr-05-2018 05:52:15 AM

Answer