文件上传不适用于ASP.Net中的AsyncPostBackTrigger [英] File upload is not working with AsyncPostBackTrigger in ASP.Net

查看:190
本文介绍了文件上传不适用于ASP.Net中的AsyncPostBackTrigger的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个html文件上传控件来上传个人资料图片,并且我正在使用更新面板和AsyncPostBackTrigger触发器.如果我使用PostBackTrigger,则可以上传个人资料图片,但是如果我使用AsyncPostBackTrigger,则不能上传.

I have one html file upload control to upload the profile picture and I'm using update panel and AsyncPostBackTrigger trigger. If I use PostBackTrigger then uploading of profile image works but If I use AsyncPostBackTrigger then uploading doesn't work.

下面是我的代码内联:

<asp:UpdatePanel ID="pnlZerkerBasicProfile" runat="server">
<input type="file" id="myFile" name="myFile" class="file_input_hidden" onchange="javascript:FileUploadSubmit();" style="cursor: pointer;" />
<Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSaveProfilePicture" />
</Triggers>
</asp:UpdatePanel>

任何人都可以帮忙吗?

推荐答案

这是一个已知问题,要使文件上传控件在更新面板中起作用,必须进行完整的回发,即您不能使用AsyncPostBackTrigger.

This is a known issue, a full postback is required for the fileupload control to work within an updatepanel i.e. you can't use a AsyncPostBackTrigger.

刚才看到的是嵌套在UpdatePanel中不起作用? C#

这篇关于文件上传不适用于ASP.Net中的AsyncPostBackTrigger的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆