I have a web site where users can upload files. I do not want those files to be accessible by anyone.
I have seen that some people create a folder (say my_secret_folder) at the same level of the www directory. Then, they upload files (with PHP script) using:
$destination = $_SERVER['DOCUMENT_ROOT'] . "/../my_secret_folder/" . $filename;
Where $destination is the full path of the uploaded file.
Then, only the PHP script (from within the www folder) is allowed to access the file. Is this a good practice to upload files to a folder outside the public www folder?
filename- e.g...\look_where_i_amhas been a security vulnerability for decades. – Voo Jan 04 '23 at 14:09