在 Chrome 中上传返回 Aw, Snap 页面 [英] Uploadify in Chrome return Aw, Snap page

查看:22
本文介绍了在 Chrome 中上传返回 Aw, Snap 页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 chrome 的上次更新(版本 36.0.1985.125 m)开始,我遇到了 uplodify 插件/flash 的问题.Chrome 会显示 Aw、Snap Page 或有时他死了,Jim!.这是我的上传代码:

from last update of chrome (Version 36.0.1985.125 m) i have problem with uplodify plugin/flash. Chrome shows Aw, Snap Page or sometimes He's Dead, Jim!. Here is my uplodify code:

<input type="file" name="file_upload" id="file_upload_50">
<script type="text/javascript">
var basePath = "path to ressources";
var errorMessage = "Error Message";
var allowExts = "*.pdf; *.xls; *.xlsx; *.rar; *.zip";
$(document).ready(function() {
    var is_error = false;
    $('#file_upload_50').uploadify({
        'swf': basePath + '/uploadify/uploadify.swf',
        'uploader': "uploader.php",
        'height': 25,
        'buttonText': "Upload",
        'fileTypeExts': allowExts,
        'fileTypeDesc': "Formats:" + allowExts,
        'formData': {
            'user_id': 50,
            'company_id': 1
        },
        'onUploadError': function(file, errorCode, errorMsg, errorString) {
            alert(errorMessage);
            is_error = true;
        },
        'onUploadSuccess': function(file, data, response) {
            var result = $.parseJSON(data);
            if (!result.result) {
                alert(result.error_msg);
                is_error = true;
            }
        },
        'onQueueComplete': function(queueData) {
            if (!is_error) {
                document.location.href = "result_page.html";
            }
        }
    });
});
</script>

问题出在哪里?你能给我一些建议吗.我很无奈.谢谢

Where is the problem? Can you get me some advice. I am helpless. Thanks

推荐答案

我发现添加 setTimeout 可以解决这个问题.这表明 Chrome/Chrome 的 Flash 实现/Uploadify 的 Flash 应用程序中存在竞争条件,具体情况尚不清楚.尽管如此,它似乎适用于我们用例的所有情况.

I've found that adding a setTimeout fixes this. This would indicate a race condition in Chrome / Chrome's Flash implementation / Uploadify's Flash app, the circumstances of which are not clear. Nonetheless, it appears to work in all situations for our use case.

$(document).ready(function () {
    setTimeout(function () {
        $('foo').uploadify({...});
    }, 0);
});

这不是一个好的答案,但在没有解决方案的情况下,这是一个可用的解决方法.

This isn't a good answer, but in the absence of a solution, it's a usable workaround.

这篇关于在 Chrome 中上传返回 Aw, Snap 页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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