我正在尝试 Uploadify 以清除上传队列并删除上传的文件。问题是这样的。如果我上传 5 个文件(一uploadLimit
组 5 个),它们是第一次上传。但是如果我使用这个清除队列:
<a class="button" href="javascript:jQuery('#attachment').uploadify('cancel', '*');">Clear Upload Queue</a>
它会从屏幕上直观地删除文件,但我仍然无法上传更多文件。我尝试使用:
jQuery('#attachment').uploadify('settings', 'uploadLimit', 5)
inonQueueClear
但它不会重置uploadLimit
. uploadLimit
队列清除后如何重置?这是我的代码:
jQuery('#attachment').uploadify({
swf: '/javascript/uploadify/uploadify.swf',
uploader: '/javascript/uploadify/uploadify.php',
uploadFolder: 'temp',
uploadTime: UPLOAD_TIME,
uploadToken: UPLOAD_TOKEN,
cancelImage: '/javascript/uploadify/cancel.png',
fileTypeExts: '*.jpg; *.gif; *.png; *.jpeg; *.doc; *.docx; *.zip; *.pdf; *.xls; *.xlsx; *.JPG',
fileTypeDesc: 'Allowed Files',
auto: true,
multi: true,
removeCompleted: false,
simUploadLimit: 1,
fileSizeLimit: '3MB',
allowedFiles: '*.jpg; *.gif; *.png; *.jpeg; *.doc; *.docx; *.zip; *.pdf; *.xls; *.xlsx; *.JPG',
// allowedFiles: '*.cdt;*.con;*.doc;*.docx;*.dxd;*.gif;*.jpg;*.jpeg;*.key;*.lab;*.mov;*.mp4;*.m4v;*.pdf;*.png;*.pps;*.ppt;*.pptx;*.rst;*.txt;*.wmv;*.xls;*.xlsx;*.zip',
uploadLimit: 5,
width: 210,
height: 40,
buttonText: 'Click to Add Up to 5 Attachments',
buttonImage: '/images/content/mail/add-attachments.png',
onUploadStart: function (file) {
jQuery('.submit').attr('disabled', 'disabled');
if (parseInt($.cookie('size')) > 0) {
$.cookie('size', parseInt($.cookie('size')) + file.size);
} else {
$.cookie('size', file.size);
}
if (parseInt($.cookie('size')) > 30000000) {
alert('You have exceeded the maximum queue size. Please delete one or more files from your upload. You can clear your queue by clicking the button below.');
jQuery('#attachment').uploadify('cancel', '*');
}
},
onUploadSuccess: function (file, data, response) {
jQuery('.submit').removeAttr('disabled');
try {
obj = jQuery.parseJSON(data);
if (obj.success) {
jQuery('#' + file.id).append('<input type="hidden" name="temp_image_path[]" value="' + obj.file.name + '" /><input type="hidden" name="original_name[]" value="' + obj.file.original_name + '" />');
}
} catch (e) {
// do nothing
}
},
onUploadError: function (file, errorCode, errorMsg, errorString) {
alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
},
onQueueComplete: function () {
jQuery('.submit').removeAttr('disabled');
},
onClearQueue: function (queueItemCount) {
//jQuery('.submit').attr('disabled', 'disabled');
var file = (queueItemCount == 1) ? 'file has' : 'files have';
alert(queueItemCount + ' ' + file + ' been removed from your upload queue. You have no files pending upload.');
$.cookie('size', 0);
jQuery('#attachment').uploadify('settings', 'uploadLimit', 5);
},
formData: {
'filetypes': '*.jpg; *.gif; *.png; *.jpeg; *.doc; *.docx; *.zip; *.pdf; *.xls; *.xlsx; *.JPG',
'folder': 'temp',
'time': UPLOAD_TIME,
'token': UPLOAD_TOKEN
}
});