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

use*_*756 9 php flash uploadify

从上次更新chrome(版本36.0.1985.125 m)我有uplodify插件/ flash的问题.Chrome显示Aw,Snap Page或者有时候他已经死了,Jim!这是我的uplodify代码:

<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>
Run Code Online (Sandbox Code Playgroud)

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

mit*_*lrj 15

我发现添加setTimeout修复此问题.这表明Chrome/Chrome的Flash实施/ Uploadify的Flash应用中存在竞争条件,其情况尚不清楚.尽管如此,它似乎适用于我们的用例的所有情况.

$(document).ready(function () {
    setTimeout(function () {
        $('foo').uploadify({...});
    }, 0);
});
Run Code Online (Sandbox Code Playgroud)

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


wic*_*k3d -1

如果这是您当前的代码 - 'basePath' 不应该是相对/直接 url 吗?

所以,而不是

var basePath = "path to ressources";
Run Code Online (Sandbox Code Playgroud)

难道不应该更像

var basePath = "/assets/RESOURCE_FOLDERNAME";
Run Code Online (Sandbox Code Playgroud)

或者一个空字符串?

  • 同样的事情也开始发生在我身上。一切都很好,自从将 Chrome 更新到最新版本以来,我每次都会看到“Aw Snap”页面。它在 IE 中工作得很好,甚至如果我只是刷新页面它也能工作,所以我不知道发生了什么。 (2认同)