我在网站上使用Fine Uploader,并且它的上传部分在Edge上运行得非常好。我发现的问题是,当我第一次点击上传按钮时,不是选择文件我关闭窗口或点击取消,对话框立即重新打开。它会继续这样做,直到我选择要上传的文件。
这似乎与我的特定Fine Uploader设置有关,因为网站上的演示不会出现同样的问题。
不确定可能出现什么问题,在发生任何上传之前问题就出现了。
按钮的HTML:
<label id="filelabel">
<div id="file">CLICK HERE TO UPLOAD PHOTO</div>
</label>
这是我必须实现的JavaScript:
var uploader = new qq.FineUploaderBasic({
//template: 'qq-template',
button: document.getElementById('file'),
request: {
endpoint: '/inc/endpoint.php',
inputName: 'qqfile'
},
validation: {
acceptFiles: ['image/jpeg', 'image/jpg', 'image/png', 'application/pdf'],
allowedExtensions: ['jpeg', 'jpg', 'pdf', 'png'],
itemLimit: 1,
sizeLimit: 15000000
},
multiple: false,
autoUpload: true,
callbacks: {
onSubmit: function(id, fileName) {
console.log('submit detected');
return true;
},
onUpload: function(id, fileName) {
console.log('upload detected');
return true;
},
onProgress: function (id, name, uploadedBytes, totalBytes) {
var percent = Math.ceil(uploadedBytes / totalBytes * 100);
$('#fileprogressbar').css('width', percent+'%');
$('#filepercentage').html(percent+'%');
if (name.search('pdf') !== -1) {
$('#filefeedback').css('color','#ff9933');
$('#filefeedback').html('PDFs require extra processing');
}
},
onComplete: function(id, name, responseJSON, xhr) {
if (responseJSON.success) {
$('#filefeedback').css('color','#093');
$('#filefeedback').html('File uploaded successfully');
$('#e_filename').val(responseJSON.uploadName);
} else {
$('#e_filename').val('');
$('#filefeedback').html(responseJSON.error);
}
},
onError: function(id, name, errorReason, xhr) {
console.log('error detected: '+errorReason);
$('#filefeedback').css('color','#f00');
$('#filefeedback').html(errorReason);
$('#e_filename').val('');
$('#fileprogressbar').css('width', '0%');
$('#filepercentage').html('0%');
},
onCancel: function(id, name) {
console.log('cancel detected');
return false;
},
onAutoRetry: function(id, name, attemptNumber) {
console.log('auto retry detected');
return false;
}
},
debug: false
});
答案 0 :(得分:1)
Ray在我的评论中回答:
这只发生在边缘吗?如果将label元素更改为,该怎么办? 别的东西,比如div?