Ajax方法调用Ajax文件上传按钮

时间:2017-11-13 08:06:16

标签: asp.net ajax ajax-upload

我使用ajax文件上传来上传直接存储在我的Dropbox帐户中的多个文件,而不让它们存储在任何本地目录或文件夹中。为此,我使用ajax调用方法。但不知何故,当我点击上传按钮上传文件时,我无法运行该ajax调用。

以下是上传多个文件的代码。

Upload.aspx

<script type="text/javascript">

                    function AjaxFileUploadEvent()
                    {
                    //$(document).ready(function () {
                        $("#<%=AjaxFileUpload1.ClientID %>").uploadify({
                            swf: 'scripts/uploadify.swf',
                            uploader: 'Upload.ashx',
                            cancelImg: 'Content/cancel.png',
                            auto: true,
                            multi: true,
                            method: 'POST',
                            //fileTypeExts: '*.jpg; *.png; *.gif; *.bmp; *.jpeg; *.JPG; *.pdf; *.doc; *.docx;',
                            buttonText: 'Upload File',
                            width: 130,
                            onUploadSuccess: function (file, data, response) {

                                var filName = file.name + Math.random();


                                $("#attachedfiles").append("<tr><td>" + file.name + "</td><td><a onclick=\"deleteHostTable(this);\"  href = 'javascript:;'>[x]</a></td></tr>");

                            },
                            onFallback: function () {
                                alert('Flash was not detected  or flash version is not supported.');

                            }
                        });
                    }

  </script>


<div>
                            <%--<asp:FileUpload ID="FileUpload1" runat="server" />
                            <table class="rounded_corners" id="attachedfiles">
                            </table>--%>
                        <asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" OnUploadComplete="AjaxFileUploadEvent" />
                        </div>

0 个答案:

没有答案