I want to make sure a file path set via query string does not go outside of the desired subdirectory. Right now, I am checking that:
Call
$path = realpath("sample/$path");
Then check that the resulting path starts with the directory you're expecting.