in reply to Scrubbing a local path in a file upload

I don't know why it works with some browsers and not others. I am surprised it works at all as you are using an assignment to $file (=) rather than the binding operator (=~).

You might try the following:

$file =~ m/^.*(\\|\/)(.*)/;
open(LOCAL, ">../../htdocs/images/photos/$2") or die "$file: $2 - $!";
while(<$file>) {
print LOCAL $_;
}

If this doesn't work, you will have a copy of the original string and what was captured as the filename in your error log. These should help you understand what is happening.

  • Comment on Re: Scrubbing a local path in a file upload