Or you could make the last part a bit simplermy $file = $q->param("uploaded_file") || error($q,"No file received"); my $type = $q->uploadInfo($file)->{'Content-Type'}; my $buffer = ""; my $type =~ s!^image/([a-zA-Z]+)$!$1!; open OUTFILE, ">$upload_dir/$file" or die "Cannot open file"; while ($bytesread=read OUTFILE, $buffer, 1024) { print OUTFILE $buffer; } close OUTFILE;
That should get you on the right track.open OUTFILE, ">$upload_dir/$file" or die "Cannot open file"; while (<$file>) { print OUTFILE; } close OUTFILE;
HTH, --traveler UPDATE: Corrected stupidities due to doing two things at once.
In reply to Re: saving a file uploaded with cgi...this is driving me insane.
by traveler
in thread saving a file uploaded with cgi...this is driving me insane.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |