JackTheRussel
Programmer
Hi.
I have made HTML-form where user can upload picture and write picture description. Then form calls script.cgi.
How can I set, that user can't upload images which are larger than 10 kt?
I have tried to do it like this, but it doesn't works.
script.cgi
Now when I run this script, it just freeze.
Nothing happens. processor is 100% use, but nothing happens.
Second question is that, how I could get size information of picture?
It would be nice to print picture size to the browser?.
I have made HTML-form where user can upload picture and write picture description. Then form calls script.cgi.
How can I set, that user can't upload images which are larger than 10 kt?
I have tried to do it like this, but it doesn't works.
script.cgi
Code:
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
$CGI::POST_MAX = 1024 * 10; # maximum upload filesize is 10K
my $query = new CGI;
print header;
print start_html("Thank You");
my $filename = param('upload_file');
my $description = param('message_box');
if (!$query->param('upload_file') && $query->cgi_error()) {
print $query->cgi_error();
print "Picture is too large. Max size is 10kt";
exit;
}
print "Thanks for you picture!";
print end_html;
...
Now when I run this script, it just freeze.
Nothing happens. processor is 100% use, but nothing happens.
Second question is that, how I could get size information of picture?
It would be nice to print picture size to the browser?.