OK, so you have a filepath made from user input; something like
$path = __DIR__ . "/uploads/{$user_input_filename}"
#1: DO NOT DO THIS. Make up your own directory names. The user has no business picking path names on your server.
#2: Filesystem traversal is bad. If you mean for the given $user_input_filename
to be inside the __DIR__ . "/uploads/
directory, take a moment to check.
<?php
$target_dir = realpath(__DIR__ . '/uploads');
$full_path = "{$target_dir}/{$user_input_filename}";
if ($full_path !== realpath($full_path)) {
/* not a real file, or a relative path that doesn't go where you expect. bad! */
}
#3: see #1