You really need to tell us what part you cant get to work. Problems with uploading? Problems with resizing? Are there error messages? What else can you tell us?
Here's one part you can fix:
foreach (@inx) {
delete @inx[$ac] if $_ =~ /^Content-Type: application\/octet-stream
+/;
$ac++;
}
delete is intended to operate on hashes (or slices thereof). Note the documentation: "Be aware that calling delete on array values is deprecated and likely to be removed in a future version of Perl.". That piece of code could be written like:
@inx = grep { $_ !~ /.../ } @inx;