我正在运行 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"> </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>