To check image upload size: my $uploaded_file = $query->upload( 'uploaded_file' ); # $query = CGI.pm object
my $buffer_size = 2049000; my $image; my $size = read( $uploaded_file, $image, $buffer_size ) or die "SYSTEM: Error reading uploaded file " . $query->param( 'uploaded_file' ); if ( $size == $buffer_size ) { error("Specified image too large ( $buffer_size bytes max )." ); } On 2/15/06, Moisés Chicharro <[EMAIL PROTECTED]> wrote: > Hi, > Thankyou for your response - much appreciated. > > Problem is the ISP is not too receptive about adding new modules to > their perl install ImageMagick doesn't seem to be on there. Before I > start the arduous process of convincing them to install a module, is > there anyway of doing it without a module? > > My main aims being: > > - check uploaded image filesize is not too large (most important) > - check uploaded image physical pixel size > - change uploaded image physical pixel size (if possible without module) > > > Cheers, > Mo > > > > > On 15 Feb 2006, at 14:09, Charlie Garrison wrote: > > > Good morning, > > > > On 15/2/06 at 12:57 PM -0000, Moisés Chicharro > > <[EMAIL PROTECTED]> wrote: > > > >> I have a perl script which enables users to upload a jpg file to my > >> webserver from their browser. However, I'd like to reformat the > >> uploaded jpeg to a certain pixel width and height so that it fits in > >> with my webpage template (and also to avoid massive files being > >> uploaded). Is there any way to do this in perl? > > > > Quite a few ways; one of the popular ones is ImageMagick. > > > > > > Charlie > > > > -- > > Charlie Garrison <[EMAIL PROTECTED]> > > PO Box 141, Windsor, NSW 2756, Australia > > > > >