One thing that snagged me with printing to a filehandle is the binmode. I
was uploading an Excel spreadsheet and writing it, but it would become
corrupted (b/c it's a binary file). So if you're dealing with binary files
(and according to the docs, if your system knows the difference [which for
me, I saw on Win2K and Linux]), do a binmode before you print to the
filehandle.
ie:
open (OUTFILE, ">/path/to/file");
while ($bytesread=read($batchUpload, $buffer, 1024)) {
binmode STDOUT; # is this necessary?
binmode OUTFILE;
print OUTFILE $buffer;
}
close (OUTFILE);
Jason
----- Original Message -----
From: "Curtis Poe" <[EMAIL PROTECTED]>
To: "CGI Beginners" <[EMAIL PROTECTED]>
Sent: Monday, July 09, 2001 12:51 PM
Subject: Re: how to upload a file through an html form?
> --- fliptop <[EMAIL PROTECTED]> wrote:
> > > Not true. Printing the file contents directly to the screen is a
common method of testing
> > whether
> > > or not the file upload was successful and has nothing to do with
whether or not Hytham was
> > > properly uploading the file.
> >
> > yes, but the original poster was confused as to why when he searched the
> > hard drive he couldn't find the file.
>
> Sigh. I need to read these darned things closer :)
>
> Cheers,
> Curtis Poe
>
> =====
> Senior Programmer
> Onsite! Technology (http://www.onsitetech.com/)
> "Ovid" on http://www.perlmonks.org/
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/