Home > DeveloperSection > Forums > FileUpload.hasFile is always False
Pravesh Singh
Pravesh Singh

Total Post:101

Points:709
Posted on    September-05-2014 12:28 AM

 ASP.Net ASP.Net 
Ratings:


 2 Reply(s)
 5172  View(s)
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"/>



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    September-05-2014 1:07 AM

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


Goti Bandu

Total Post:119

Points:835
Posted on    September-19-2014 7:29 AM

<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

Don't want to miss updates? Please click the below button!

Follow MindStick