Ajax异步文件上传:On Upload Complete未触发

时间:2014-01-31 21:07:51

标签: ajax asp.net-ajax asyncfileupload

这是我的HTML:

<ajax:asyncfileupload runat="server"  onuploadedcomplete="AsyncFileUploaderUploadedComplete" />

这是背后的代码:

protected void AsyncFileUploaderUploadedComplete(object sender, AsyncFileUploadEventArgs e)
    {
       string file = "Upload complete!";
    }

当我在字符串行上放置调试中断并运行程序时,它永远不会到达调试行。知道为什么onUploadedComplete不工作?谢谢你的帮助

2 个答案:

答案 0 :(得分:0)

尝试修改html:

<ajax:asyncfileupload ID="fileupload1" runat="server"  onuploadedcomplete="AsyncFileUploaderUploadedComplete" />

答案 1 :(得分:0)

我遇到了同样的问题并解决了这个问题:

   <script type="text/javascript">
            function startUpload() {
                document.forms[0].enctype = 'multipart/form-data';
            } </script>

         <ajaxToolkit:AsyncFileUpload runat="server" ID="asyncUploadMap" 
    OnUploadedComplete="asyncUploadMap_UploadedComplete" 
     OnClientUploadStarted="startUpload" OnClientUploadComplete="finishUpload" 
 UploaderStyle="Modern" />