我使用blueimp(https://github.com/blueimp/jQuery-File-Upload)的插件上传文件。
我遇到问题,当我上传多个文件(例如20张图片)时,前7个文件正确上传,但在我收到PHP错误后(上传的文件只是部分上传)。
是否可以使用此插件配置以避免此问题?
我设置了这样的插件:
$('#upload').fileupload({
// This element will accept file drag/drop uploading
dropZone: $('#drop'),
maxFileSize: 5000000,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
// This function is called when a file is added to the queue;
// either via the browse button, or via drag/drop:
add: function(e, data) {
var tpl = $('<li class="working"><input type="text" value="0" data-width="48" data-height="48"' +
' data-fgColor="#0788a5" data-readOnly="1" data-bgColor="#3e4043" /><p></p><span></span></li>');
// Append the file name and file size
tpl.find('p').text(data.files[0].name)
.append('<i>' + formatFileSize(data.files[0].size) + '</i>');
// Add the HTML to the UL element
data.context = tpl.appendTo(ul);
// Initialize the knob plugin
tpl.find('input').knob();
// Listen for clicks on the cancel icon
tpl.find('span').click(function() {
if (tpl.hasClass('working')) {
jqXHR.abort();
}
tpl.fadeOut(function() {
tpl.remove();
});
});
// Automatically upload the file once it is added to the queue
var jqXHR = data.submit();
},
progress: function(e, data) {
// Calculate the completion percentage of the upload
var progress = parseInt(data.loaded / data.total * 100, 10);
// Update the hidden input field and trigger a change
// so that the jQuery knob plugin knows to update the dial
data.context.find('input').val(progress).change();
if (progress == 100) {
data.context.removeClass('working');
}
},
fail: function(e, data) {
// Something has gone wrong!
data.context.addClass('error');
}
});
任何想法可能是什么问题?
感谢您的帮助
答案 0 :(得分:1)
尝试 检查: upload_max_filesize = 100M post_max_size = 100M
在你的php.ini
中答案 1 :(得分:0)
我找到了一个解决方案,我在我的网络服务器上将协议FastCGI更改为CGI并且它可以工作; - )