FileUpload.hasFile永远是假 [英] FileUpload.hasFile is always False
本文介绍了FileUpload.hasFile永远是假的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个文件上传
控件(它不是内部的的UpdatePanel
)和 hasFile
属性始终是假
。
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"/>
任何想法?
推荐答案
添加触发器为您的UpdatePanel
Add a trigger for your UpdatePanel
<Triggers>
<asp:PostBackTrigger ControlID="btnCertificateUpload" />
</Triggers>
这将迫使回传被点击上传按钮时。
This will force a postback when the upload button is clicked.
此外,添加下面一行到Page_Load
Also add the line below to the Page_Load
Page.Form.Attributes.Add("enctype", "multipart/form-data");
这篇关于FileUpload.hasFile永远是假的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文