lundi 29 décembre 2014

FileUpload control's ".HasFile" property returning False even after file is selected?



I am creating a visual web-part for my SharePoint 2013 environment. I am using asp:FileUpload control(fuBrowseXMLFile) in this web-part for uploading files to a document library. I have a button Save to initiate the process of uploading the file.


After deploying the code, i try to run it in Debug mode. I found that after clicking the Save button, when the debugger hits the following line of code,



if (fuBrowseXMLFile.HasFile)


fuBrowseXMLFile.HasFile returns FALSE. Whereas the file is selected in the control.


While searching for a solution, I came across lot of articles. But, unfortunately most of them talk with reference to UpdatePanel. I am not using UpdatePanel here.


I understand that it has to do something with Postback. But, I am not sure what would exactly resolve my problem.








0 commentaires:

Enregistrer un commentaire