------------
#!/usr/bin/perl
use CGI qw/:standard/;
if ($ENV{'CONTENT_TYPE'} !~ /multipart/form-data/) {
print "Cache-Control: no-cachenPragma: no-cachen" .
"Content-Type: text/htmlnn" .
"<html><body>Your web browser cannot upload files. Sorry.</body></html>";
exit 0;
}
$cntfile=param('cnt');
print header;
print start_html;
#print "Receiving Please wait....";
&g_head;
#$writed = '../www/test/tmp/';
for ($i=0;$i<$cntfile;$i++){
$paramfile = 'file'.$i;
$parampath='path'.$i;
$writed=param($parampath);
&upfile;
&g_body;
}
&g_bott;
#<<<<<<<<<<<<<<<<<<<<<以下为自定义过程<<<<<<<<<<<<<<<<<<<<<<<<<
sub upfile
{
$maxdata = 512000;
# $writed = '../www/test/tmp/';
$strRFname=reverse $xfile;
$intIndex=index($strRFname,'\');
$strNetFname=substr($strRFname,0,$intIndex);
$strNetFname=scalar reverse $strNetFname;
if((stat $xfile)[7]>$maxdata){
print "Status: 411 Size Not Allowedn" .
"Content-Type: text/htmlnAllow: POSTnn" .
"<html><head><title>411 411 Size Not Allowed</title></head><body><h1> You got big problem. Try again.</h1></body></html>n";
exit 0;
}
binmode $xfile;
use File::Copy;
copy($xfile,$writed.$strNetFname);
}
sub g_head{
print '<table border=1 alig
#!/usr/bin/perl
use CGI qw/:standard/;
if ($ENV{'CONTENT_TYPE'} !~ /multipart/form-data/) {
print "Cache-Control: no-cachenPragma: no-cachen" .
"Content-Type: text/htmlnn" .
"<html><body>Your web browser cannot upload files. Sorry.</body></html>";
exit 0;
}
$cntfile=param('cnt');
print header;
print start_html;
#print "Receiving Please wait....";
&g_head;
#$writed = '../www/test/tmp/';
for ($i=0;$i<$cntfile;$i++){
$paramfile = 'file'.$i;
$parampath='path'.$i;
$writed=param($parampath);
&upfile;
&g_body;
}
&g_bott;
#<<<<<<<<<<<<<<<<<<<<<以下为自定义过程<<<<<<<<<<<<<<<<<<<<<<<<<
sub upfile
{
$maxdata = 512000;
# $writed = '../www/test/tmp/';
$strRFname=reverse $xfile;
$intIndex=index($strRFname,'\');
$strNetFname=substr($strRFname,0,$intIndex);
$strNetFname=scalar reverse $strNetFname;
if((stat $xfile)[7]>$maxdata){
print "Status: 411 Size Not Allowedn" .
"Content-Type: text/htmlnAllow: POSTnn" .
"<html><head><title>411 411 Size Not Allowed</title></head><body><h1> You got big problem. Try again.</h1></body></html>n";
exit 0;
}
binmode $xfile;
use File::Copy;
copy($xfile,$writed.$strNetFname);
}
sub g_head{
print '<table border=1 alig
| 对此文章发表了评论 |
