我无法使用Uploadify和Uploadifive使文件上传工作可靠(我在浏览器不支持Uploadifive时配置了后备)。
大多数情况下,所有文件都可以直接上传到目的地。但是,随机地,队列中的一个文件不会直接出现在目的地中(所有其他文件在多文件选择期间出现)。注意' auto'设置为true。
失踪'
文件仍然会在页面上的队列中显示,但不会上传。调查Firebug中的POST显示发送到上传脚本的大多数文件都包含文件数据和令牌变量。但是没有工作的单个文件不会发送文件数据或令牌(该文件上传的POST为0KB)。
不幸的是,这种行为是零星的,或者至少我无法解决这种模式。如果我从队列中删除该文件并重新上传,则可以正常工作。如果我清除浏览器缓存,刷新页面并尝试一次上传同一组文件,所有文件都将成功上传。
问题出现在不同的浏览器(IE11,FF)上。
服务器文件正在上传到IIS7.5。
有时也会发生单个文件。例如。所选的一个文件将在队列中显示,但不会上传任何内容。
我添加了enctype =' multipart / form-data'在我的标签上
任何帮助都非常感谢!
$(document).ready(function() {
$('#uploadifive').uploadifive({
'auto' : true,
'fileSizeLimit' : "5GB",
'formData' : { 'token' : '<?php echo $token; ?>' },
'queueSizeLimit' : 0,
'removeCompleted' : false,
'uploadScript' : '/assets/transmitdocs_tempuploads/transmitdocs_moveFilesToServer.php',
'onCancel' : function (file) {
deleteFromUploadifyQueue (file.id, file.name);
},
'onUpload' : function (file) {
document.getElementById('subGoToStepFive').value = "Please wait...";
document.getElementById('subGoToStepFive').disabled = 'disabled';
},
'onQueueComplete' : function () {
document.getElementById('subGoToStepFive').value = "Next >";
document.getElementById('subGoToStepFive').disabled = '';
},
'onFallback' : function () {
$('#uploadifive').hide();
$('.uploadifive-queue-item').hide();
$('#uploadify').show();
$('.uploadify-queue-item').show();
$('#uploadify').uploadify({
'auto' : true,
'fileSizeLimit' : "5GB",
'formData' : { 'token' : '<?php echo $token; ?>' },
'removeCompleted' : false,
'queueSizeLimit' : 0,
'swf' : '/assets/addons/uploadify3/uploadify.swf',
'uploader' : '/assets/transmitdocs_tempuploads/transmitdocs_moveFilesToServer.php',
//'onCancel' doesn't work after file upload is completed, so need to create custom delete using onUploadSuccess
'onUploadError' : function (file, errorCode, errorMsg, errorString) {
alert("The file you selected ("+file.name+") was unable to be uploaded. Error was: "+errorMsg+" "+errorString);
},
'onUploadStart' : function () {
document.getElementById('subGoToStepFive').value = "Please wait...";
document.getElementById('subGoToStepFive').disabled = 'disabled';
},
'onUploadSuccess' : function (file) {
$(".uploadify-progress").fadeOut();
document.getElementById(file.id).style.position = "relative";
var cancelIcon = document.createElement("img");
cancelIcon.src = "/assets/icons/15x15/delete.png";
cancelIcon.alt = "Remove " + file.name + " from this transmittal";
cancelIcon.title = "Remove " + file.name + " from this transmittal";
cancelIcon.setAttribute ("onclick", "deleteFromUploadifyQueue(\"" + escape(file.id) + "\", \"" + escape(file.name) + "\");");
cancelIcon.style.position = "absolute";
cancelIcon.style.right = "0px";
cancelIcon.style.top = "0px";
cancelIcon.style.padding = "10px";
cancelIcon.style.cursor = "pointer";
cancelIcon.style.display = "none";
document.getElementById(file.id).appendChild(cancelIcon);
$(cancelIcon).fadeIn();
},
'onQueueComplete' : function () {
document.getElementById('subGoToStepFive').value = "Next >";
document.getElementById('subGoToStepFive').disabled = '';
}
});
}
});
});