I am uploading file using ASP.net File upload control. My FileUpload1.HasFile is always returning false.
if (FileUpload1.HasFile)
{
DBOpe
ASP.NET's "AJAX" thing doesn't support file uploads in UpdatePanels out of the box. Change that trigger into a PostBackTrigger
(which causes a full page load) or use something else to upload the file.
Add a trigger for your UpdatePanel
<Triggers>
<asp:PostBackTrigger ControlID="btnUploadFile" />
</Triggers>
This will force a postback when the upload button is clicked.
Also add the line below to the Page_Load
Page.Form.Attributes.Add("enctype", "multipart/form-data");
I know this post if old, but I found that if the file is empty [ 0 KB ] then it will return false as well. There has to be something in the file in order for .HasFile to acknowledge it.