FILEUPLOAD.HASFILE IS ALWAYS FALSE

Pravesh Singh

Total Post:101

Points:709
Posted by  Pravesh Singh
 6806  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. Sumit Kesarwani

    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);

  1. Goti Bandu

    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 Sep-19-2014 07:29:33 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!