我将在Plesk / apache上运行的uploadify设置为FastCGI上传到文件根目录的上传文件。这似乎适用于小于1MB的文件,但在更大的文件上创建了ERROR 500.
$(function() {
var idx=$('.useri').val();
$('#file_upload2').uploadify({
'multi' : false,
'swf' : 'images/uploadify.swf',
'uploader' : 'admin_includes/uploadify.php',
'formData' : {'user_id': idx},
'fileSizeLimit' : '10MB',
// Put your options here
// Some options
'onUploadSuccess' : function(file, data, response) {
if(data==2)
{
alert("File Extension needs to be either .docx, .doc or .pdf");
}
else
{
var data_split=data.split("|");
$('.title_holder').fadeIn(200);
$('.upload_hider').show();
$('.added_file').html("");
$('.message12').html('<p class="added_file" data-file2='+data_split[1]+'>'+data_split[0]+' Successfully Uploaded.</p>');
}
}
});
});
我还将php.ini设置如下
safe_mode = Off
upload_tmp_dir /tmp
upload_max_filesize = 40M
post_max_size = 40M
这似乎也不起作用。我有什么遗漏或似乎做错了吗?
答案 0 :(得分:2)
尝试将sizeLimit
选项设置为
'sizeLimit': 5000000000
另外,作为建议,您可以尝试在uploadify调用中订阅onError处理程序。这样的事情,在onUploadSuccess
处理程序......
onError: function(a, b, c, d) {
if (d.status == 404) alert('Could not find upload script.');
else if (d.type === "HTTP") alert('error ' + d.type + ": " + d.status);
else if (d.type === "File Size") alert(c.name + ' ' + d.type + ": " + d.status);
else alert('error ' + d.type + ": " + d.text);
}
答案 1 :(得分:1)
感谢您的帮助,但我似乎已经解决了这个问题。 我在这个帖子中没有说的是我的服务器安装了Plesk 10.3.1。看来这个版本的Plesk会将服务器配置中的maxRequestLen覆盖为128Kb。
解决方案是在/usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php或/etc/httpd/conf.d中将此重置为1GB(正常默认大小)或所需大小。 /fcgid.conf并重启服务器。
就我所知,Plesk的未来版本没有这个问题。
答案 2 :(得分:0)
您可能会收到与PHP配置相关的错误。除了upload_max_filesize
和post_max_size
之外,您还应该拥有以下值:
max_execution_time
max_input_time
两者都定义了脚本的最长生命周期以及脚本在接受输入时应花费的时间。