#!/usr/bin/perl
use CGI::Simple;
$CGI::Simple::DISABLE_UPLOADS = 0; # enable uploads
my $q = new CGI::Simple;
if($q->param("photo")) {
fech();
} else {
print <<DONE
Content-type: text/html
<form action="up.pl" method="post" enctype="multipart/form-data" >
<input type="file" name="photo" />
<input type="submit" />
</form>
DONE
}
sub fech {
$filename = $q->upload("photo");
open UPLOADFILE, ">img/up.out" or die "$!";
binmode UPLOADFILE;
my $buffer;
while( read($filename, $buffer, 1024) )
{
print UPLOADFILE $buffer;
}
close UPLOADFILE;
# $detail = "$id , $name , $color , blah blah...\<img src=\"$domain/MaiNGate/pics/big/$id.gif\"\>";
print "Content-type: text/html\r\n\r\nUploaded ".$filename.".\n";
}
|