在 Chrome 中上传返回 Aw, Snap 页面

Uploadify in Chrome return Aw, Snap page(在 Chrome 中上传返回 Aw, Snap 页面)
本文介绍了在 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 页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Encryption in JavaScript and decryption with PHP(JavaScript 加密和 PHP 解密)
Best solution to protect PHP code without encryption(无需加密即可保护 PHP 代码的最佳解决方案)
PHP AES encrypt / decrypt(PHP AES 加密/解密)
Upgrading my encryption library from Mcrypt to OpenSSL(将我的加密库从 Mcrypt 升级到 OpenSSL)
How to add/remove PKCS7 padding from an AES encrypted string?(如何从 AES 加密字符串中添加/删除 PKCS7 填充?)
How do I upgrade from PHP 7.0 to 7.3 on google cloud platform?(如何在谷歌云平台上从 PHP 7.0 升级到 7.3?)