Check you php.ini file there a 2 entries that will prevent large file uploads from working correctly. max_execution_time specifies how long a script can run. Change this to a number that you are comfortable with. upload_max_filesize specifies the largest file accepted by php. 2M is the default maximum. Change this to number that you are comfortable with. max_execution_time = 2000 ; Maximum execution time of each script, in seconds upload_max_filesize = 50M ; Maxium file upload size Restart apache after making changes.
连10M都不行,谁知道原因?(我再加100分)
把那个UOLOAD改到30M后,还是只能够上传大约7M左右的文件。???
cf_journey(陶醉)你上传几百兆,你用卫星呀!夸张。
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value=$MaxUpload>$MaxUpload的值就是要设置的上传文件的上限~!
但其单位是'字节'.
如,你的上限是2m,那$MaxUpload的值就是2097152你试试吧~!
我们可以变通变通吗.
不过话又说回来的cf_journey同志,你的方法确实不可行啊:)建议你好好研究一下Socket,做一个点对点传输程序,像QQ那样的。帮你UP~~~(up是一种美德)
我先测试一下,有了结果一定告诉大家!
max_execution_time = 2000 ; Maximum execution time of each script, in seconds
upload_max_filesize = 50M ; Maxium file upload size
Restart apache after making changes.
给我mail一份吧,谢谢
[email protected]
8m
这样说,用PHP就不合适用来上传大文件了,要不几个人同时上传大文件,还得了。
也许跟带宽,或是超时什么的有关系~!超时是改apache 的httpd.conf文件~!
##################test.php######################################
<html>
<body>
<form method="POST" action="../../cgi-bin/bupload.pl" ENCTYPE="multipart/form-data">
File 1:
<input type="file" name="FILE1">
<br>
File 2:
<input type="file" name="FILE2">
<br>
<input type="submit" value="Upload!">
</form>
</body>
</html>
####################bupload.pl#######################
#!c:/perl/bin/perl.exeuse CGI;
$upfilecount = 1;
$maxuploadcount = 2; #限制上传文件的最大数
$basedir = "../htdocs/upload/vod"; #上传的文件存放地址
$allowall = "no"; #是否不限制文件后缀上传
@theext =(".jpg",".bmp"); #要限制的文件后缀名#print "Content-type: text/html\n\n";$query=new CGI;
while ($upfilecount <= $maxuploadcount) {
my $req = new CGI;
my $file = $req->param("FILE$upfilecount");
if ($file ne "") {
my $fileName = $file;
$fileName =~ s/^.*(\\|\/)//; #用正则表达式去除无用的路径名,得到文件名
my $newmain = $fileName;
my $filenotgood;
if ($allowall ne "yes") {
$extname = lc(substr($newmain,length($newmain) - 4,4)); #取后缀名
for(my $i = 0; $i < @theext; $i++){ #这段进行后缀名检测
if ($extname eq $theext[$i]){
$filenotgood = "yes";
last;
}
}
}
if ($filenotgood ne "yes") { #这段开始上传
open (OUTFILE, ">$basedir/$fileName");
binmode(OUTFILE); #务必全用二进制方式,这样就可以放心上传二进制文件了。而且文本文件也不会受干扰
while (my $bytesread = read($file, my $buffer, 1024)) {
print OUTFILE $buffer;
}
close (OUTFILE);$new_url="../load/upload.php?name=$fileName";
$message.=$file . " 已成功上传!<br>\n";
}
else{
$message.=$file . " 文件后缀不符合要求,上传失败!<br>\n";
}
}
$upfilecount++;
}#print($new_url);
print $query->redirect($new_url); #最后输出上传信息
######################upload.php###########################
<?php
// get infomation file
$file=$name; // rename file
if ($file) {
$file_sub=strtok($file,".");
if ($file_sub) $file_sub=strtok(".");
$date=getdate();
$dest_filename="hztecklink-".$date["year"].$date["mon"].$date["mday"].$date["hours"].$date["minutes"].$date["seconds"].".".$file_sub;
$dest = "../upload/vod/".$dest_filename;
$target="../upload/vod/".$file;
if (!rename($target,$dest)) {
echo ("重命名失败!");
echo "<br>Target=",$target;
exit;
}
}header("location:test.php");
###############################################
注:上载的perl程序是由一个网友提供的。在此表示感谢!这个程序能上载好大的文件,我上载过的最大的文件是623M!