in reply to Upload a file from a web form
This works for me, hope its some help to you.
open (OUTPUT,">$outfile") || die "Cannot open image file: $!"; binmode(OUTPUT); my $buffer; while (my $bytesread = read($filename_thumbnail, $buffer, 4096)) { my $length += $bytesread; print OUTPUT $buffer || die "Cannot write the image to file: $!"; } close OUTPUT || die "Cannot close image file: $!"; my $koko = int(($length+512)/1024); my $maxsize="1024"; if($koko > $maxsize && $maxsize > 0) { unlink "$outfile"; print "File size is limited to ". $maxsize ."KB<br>$koko"; }
Then the form should look like this
<form name="additem" method="post" action="$ENV{'SCRIPT_NAME'} enctype +="multipart/form-data"> <input type="file" name="outfile" size="10" class="submit"> <input type="submit"> </form>
I kinda missed out some usual CGI and perl bits there, but I hope that's some help to you.
Cheers,
Tom
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Upload a file from a web form
by CodeJunkie (Monk) on Jul 10, 2003 at 09:29 UTC | |
by bodmin (Sexton) on Jul 18, 2003 at 15:07 UTC |