web_master Posted May 19, 2008 Share Posted May 19, 2008 hi, is there some possibility to hide destination of the downloadable file with PHP? thanx Quote Link to comment https://forums.phpfreaks.com/topic/106281-hide-destination-of-the-downloadable-file/ Share on other sites More sharing options...
MadTechie Posted May 19, 2008 Share Posted May 19, 2008 put the files in a hidden folder or a folder outside of the public_html folder. ie /hidden_path/myfile.jpg now a simple script (used ober's force download as a base) <?php $file = "/hidden_path/".$_REQUEST['file']; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header( "Content-Disposition: attachment; filename=".basename($file)); header( "Content-Description: File Transfer"); @readfile($file); ?> Quote Link to comment https://forums.phpfreaks.com/topic/106281-hide-destination-of-the-downloadable-file/#findComment-544714 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.