[Solved] load images using php not direct access [closed]
[ad_1] You need to use readfile: function user_files($file_name = “”) { // Check file_name is valid and only contains valid chars if ((preg_match(‘^[A-Za-z0-9]{1,32}+[.]{1}[A-Za-z]{3,4}$^’, $file_name)) { header(‘Content-Type: ‘.get_mime_by_extension(YOUR_PATH.$file_name))); readfile(YOUR_PATH.$file_name); } } There is some issues around directory traversal etc – so you’ll need to check the $file_name first like I have using the preg_match [ad_2] solved … Read more