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?
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?
You cannot upload files using AJAX => you should not be placing a FileUpload control inside an UpdatePanel because this UpdatePanel sends an AJAX request to the server.
Add a trigger for your UpdatePanel
This will force a postback when the upload button is clicked.
Also add the line below to the Page_Load
I also uploaded a file using the FileUpload control, but the HasFile property returned false. Turn out that FileUpload.HasFile is also false if you upload an empty file. In this case adding some text to the file you want to upload will make the Hasfile property return true.
the whole time it was about the permissions i had(or didn't have to be more specific) over the file am trying to upload, i granted the user the sufficient permissions and it all went well.
thanks a lot for your help and posts.
To complement the example given by @dbFrameIT Support:
your code behind (c#)
Sometimes fileUpload has problems. You can use simple input:
In code save file to server:
And file will save at UploadDocuments folder in your ASP.NET application (server)