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
In reply to Re: Upload a file from a web form
by CodeJunkie
in thread Upload a file from a web form
by bodmin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |