Hi progress,
Please use the code /code blocks when you post code. It's much easier for people to read if it's formatted correctly.
Now for your problems. You should put the chmod after this bit of code:
Code:
print OUTFILE $buffer;
}
close(OUTFILE);
chmod 0644, "$Imageuploadpath$tstamp.$extension" or die "Unable to chmod: $!";
You also have another, more serious, problem in this bit of code:
Code:
if ($Image_Upload_1 = ~/delete/i) {
$Image_Upload_1 = "";
$Image_Upload_1delete = $query->param('Image_Upload_1b');
if ($Image_Upload_1delete) {
unlink("$Imageuploadpath$Image_Upload_1delete");
}
}
You are not doing any taint checking on your user input. What happens if someone entered something like
../../../public_html/index.html (or something worse) into your form? Once an unscrupulous person figures out a good path they can start deleting all your files.
http://perldoc.perl.org/perlsec.html
~Charlie