Jump to content

hide destination of the downloadable file


web_master

Recommended Posts

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);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.