I'm writing a plugin for a CMS that will manipulate images (resize them). How can I ensure that only certain directories are ok?
I want the user to be able to define what directory they want the script to look in (and find all images).
I know I could ask for $_POST['sub_directory_to_look_in']
and glob('galleries/' . $_POST['sub_directory_to_look_in'] . '/*.jpg');
and ensure that $_POST['sub_directory_to_look_in']
doesn't have '../'
, but are there any security issues with doing this?
I've looked into basedir
function but not sure if that will help