Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在IE7中使用fineuploader时如何捕获onComplete事件_Javascript_Json_Internet Explorer 7_Fine Uploader - Fatal编程技术网

Javascript 在IE7中使用fineuploader时如何捕获onComplete事件

Javascript 在IE7中使用fineuploader时如何捕获onComplete事件,javascript,json,internet-explorer-7,fine-uploader,Javascript,Json,Internet Explorer 7,Fine Uploader,我在部分视图中使用fineuploader,它将在单个页面中出现多次。因此将有多个fineuploader实例。它在IE 10中运行良好。 在IE7中,如上所述,转到回退机制并显示上载按钮。 单击“自动上载”后,它将成功上载文件。 在服务器端,我生成fileId作为Guid并以Json格式返回。因为IE7不支持XHR2;我没有得到onComplete事件,json以下载的形式返回 是否有任何方法可以让我知道文件上传已完成,并返回生成的文件ID 事先非常感谢你的帮助 这是我的密码: functio

我在部分视图中使用fineuploader,它将在单个页面中出现多次。因此将有多个fineuploader实例。它在IE 10中运行良好。 在IE7中,如上所述,转到回退机制并显示上载按钮。 单击“自动上载”后,它将成功上载文件。 在服务器端,我生成fileId作为Guid并以Json格式返回。因为IE7不支持XHR2;我没有得到onComplete事件,json以下载的形式返回

是否有任何方法可以让我知道文件上传已完成,并返回生成的文件ID

事先非常感谢你的帮助

这是我的密码:

function InitializeDragDrop(id, isSingle, oldfiles, fieldId) {


    var itemLimit = isSingle == true ? 1 : 10;

    var restrictedUploader = new qq.FineUploader({
        //debug:true,
        element: document.getElementById(id),
        template: 'qq-template',
        callbacks: {
            onError: function(fileid, name, errorReason, xhr) {
                alert(errorReason);
            },
            onComplete: function(fileid, name, response, xhr) {
                debugger;
                if (response.success != '') {
                    fileid = response.newUuid;
                    addFileToList(fileid, fieldId);
                }
            },
            onDeleteComplete: function(fileid, xhr, isError) {
                if (!isError) {
                    fileid = $.parseJSON('[' + xhr.response + ']')[0].newUuid;
                    removeFileFromList(fileid, fieldId);
                }
            },
            onValidate: function(data, btnName) {
                var filename = data.name;
                var result = $.ajax({
                    type: "GET",
                    url: '../ReferredFieldSelector/CheckDuplicateFileName?fileName=' + filename,
                    async: false
                }).responseText;
                if (result == 'True') {
                    ShowDuplidateFilePopup(filename);
                    return false;
                }
            }
        },
        request: {
            endpoint: '@Url.Action("UploadFiles", "ReferredFieldSelector")',
            params: { fieldId: fieldId }
        },
        validation: {
            itemLimit: itemLimit,
            stopOnFirstInvalidFile: false
        },
        //messages: {
        //    tooManyItemsError : "Too many items ({netItems}) would be uploaded.  Item limit is {itemLimit}.",
        //},
        cors: {
            //all requests are expected to be cross-domain requests
            expected: true,

            //if you want cookies to be sent along with the request
            sendCredentials: true
        },
        deleteFile: {
            enabled: true,
            method: 'POST', // defaults to false
            endpoint: '@Url.Action("DeleteTempararyFiles", "ReferredFieldSelector")'
        }
    });

    if (!(typeof(oldfiles) === 'undefined')) {

        restrictedUploader.addInitialFiles(oldfiles);
    }

};
更新:

我已经尝试过将内容类型更改为“text/plain”,正如您在一篇文章中所建议的那样

但它给了我以下的错误

我从服务器得到的响应如下:

HTTP/1.1 200 OK
Cache-Control: private, s-maxage=0
Content-Type: text/plain; charset=utf-8
Server: Microsoft-IIS/10.0
X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 25 Oct 2016 20:38:48 GMT
Content-Length: 75

{"success":true,"newUuid":"61bb0f01-e763-4649-b975-20fbc0eefa3d","name":""}
有什么错误吗

我需要新生成的newUuid用于客户端处理,因为我正在临时位置上传到服务器,当我最终保存主表单时,我将文件从临时位置移动到最终位置,以便执行此操作,我将这些ID保留在客户端列表中,直到用户保存表单


如果我将调试器放在事件中,直到验证事件正常工作,但在这之后,onSubmit、onComplete、onAllcomplete不会启动,但文件已成功上载到服务器。

可能重复尝试更改的内容。在主要问题中添加了回答。您是否在IE8中看到相同的问题?IE7在很大程度上是一个死气沉沉的浏览器,因此我无法验证或修复该浏览器中可能出现的任何问题。是的,IE8上的相同行为可能会重复尝试更改的内容。在主要问题中添加了回答。您是否在IE8中看到相同的问题?IE7在很大程度上是一个死气沉沉的浏览器,因此我无法验证或修复该浏览器中可能出现的任何问题。是的,IE8上也存在同样的行为