Vb.net – FileUpload.hasFile is always False

asp.netfile-uploadvb.net

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"/>

Any thought?

Best Solution

Add a trigger for your UpdatePanel

<Triggers>
   <asp:PostBackTrigger ControlID="btnCertificateUpload" />
</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");