here is a quick example, i would recomend CGI.pm as it solves a lot of
prebles for you, or if you wanna lower memory usage, then open up cgi.pm and
take out the cod eyou need to do what you want and make your own OOP.

use CGI qw(:cgi);       # Import the CGI package

my $basedir = "/tmp";

my $onnum = 1;

my $req = new CGI;

# Example where you can upload 6 files max.
if ($req->param('button') eq "Upload!") {
 while ($onnum != 7) {
  my $req = new CGI;
  my $file = $req->param("FILE$onnum");
  if ($file ne "") {
   my $fileName = $file;
   $fileName =~ s!^.*(\\|\/)!!; # Get the filename, der :)

   open (OUTFILE, ">$basedir/$fileName");
   while (my $bytesread = read($file, my $buffer, 1024)) {
    print OUTFILE $buffer;
   }
   close (OUTFILE);

  }
  $onnum++;
 }
}


----- Original Message -----
From: "Aaron Craig" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 10, 2001 10:26 AM
Subject: Re: how to upload a file through an html form, again.


> At 00:59 10.07.2001 -0400, Jason Purdy wrote:
> >Check out the CGI documentation - it's very thorough and has a lot of
> >excellent examples.
>
> I can't recommend CGI.pm highly enough for file upload.  I tried to grow
my
> own as a learning experience, and gave up in frustration -- too many
> differences between browsers, OS's, etc. etc.  I did have problems getting
> it to work at the beginning, but once you get it going, it works like a
charm.
>
>
>
> Aaron Craig
> Programming
> iSoftitler.com

Reply via email to