I would like to read this image file before using the code inside of the while loop. Just in case the image been uplaoded is too bigNot a good way of finding out the file size, the simplest is to use -s. For example:
my $size = -s IMAGE;
or :
my $size = -s $filename;