FileUpload.hasFile is always False
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a FileUpload control (and it's not inside an UpdatePanel ) and its hasFile property is always False . Any thought? 回答1: 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 Page.Form.Attributes.Add("enctype", "multipart/form-data"); 回答2: 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. 回答3: I also uploaded a file using the FileUpload