django-filer - 上传按钮不适用于Firefox但在Chrome和Opera上运行良好

时间:2014-04-06 14:21:27

标签: django firefox amazon-s3 django-filer

我正在运行django 1.6,django-storages和s3。所有这些看起来都很好。当我上传图像时,它按预期进入s3。我正在尝试使用django-filer,但我无法上传任何图片。

当我点击上传时,Firefox中根本没有任何操作,但在Chrome和Opera中,文件上传对话框打开,我可以上传图像。我也试过安全模式。

以下是按钮的HTML和JS:

<ul class="object-tools">
    <li>
        <a id="id_upload_button" class="addlink" title="upload files" href="#">Upload</a>
    </li>
    <script type="text/javascript">
    //<![CDATA[
    $(function() {
        var uploader = new qq.FileUploaderBasic({
            action: '/admin/filer/clipboard/operations/upload/',
            button: document.getElementById('id_upload_button'),
            onSubmit: function(id, fileName) {
                $("#fileInputQueue .noItemsRow").hide();
                $('#fileInputQueue').append('<tr id="fileUpload-' + id + '" class="clipboardItem fileUploadQueueItem"><td class="thumbnail"><div class="loadingThumb" /></td><td class="label"><div><span class="fileName">' + fileName + ' (<span class="size">?</span>)</span> [<span class="percentage">&nbsp;</span>]</div><div class="fileUploadProgress" style="width: 100%;"><div id="fileUpload-' + id + '-ProgressBar" class="fileUploadProgressBar" style="width: 1px; height: 3px;"></div></div></td></tr>');
            },
            onProgress: function(id, fileName, loaded, total) {
                var percent = Math.round(loaded / total * 100);
                $('#fileUpload-' + id + ' .size').html(uploader._formatSize(total));
                $('#fileUpload-' + id + ' .percentage').html('' + percent + "%");
                $('#fileUpload-' + id + '-ProgressBar').css('width', percent + "%");
            },
            onComplete: function(id, fileName, responseJSON) {
                var file = responseJSON;
                if (file.error) {
                    var html = '\
<td class="thumbnail"><img style="width: 32px;height: 32px;" src="http://s3.amazonaws.com/addition-interiors/static/filer//icons/missingfile_32x32.png" alt="file missing" /></td>\
<td class="label">' + file.error + '</td>\
<td class="buttons"></td>';
                } else {
                    var html = '\
<td class="thumbnail"><img style="width: 32px;height: 32px;" src="' + file.thumbnail + '" alt="' + file.alt_text + '" /></td>\
<td class="label">' + file.label + '</td>\
<td class="buttons"></td>';
                }
                $('#fileUpload-' + id).html(html);
            },
            onCancel: function(id, fileName) {
                $('#fileUpload-' + id).hide();
            }
        });
    });
    //]]>
    </script>

1 个答案:

答案 0 :(得分:1)

我删除了我的S3 buck静态文件夹中的所有内容并再次运行collectstatic。我猜有一些未知的冲突。