my $remotefile = param("image"); # make new variable to prevent overwriting my $filename = $remotefile; # remove all the junk in our filename $filename =~ s/^.*[\\\/]//; #begin image magic my ($image, $x); $image=Image::Magick->new; $x = $image->Read($localfile); warn "$x" if "$x"; $x = $image->Resize(width=>500, height=>500); $localfile = $filename; $localfile =~ /(.*)\.(.*)/; $newfilename = "$1.png"; $x = $image->Write($newfilename); warn "$x" if "$x";