Unviewable download link

A

Anonymous

Guest
Hi,

is there a way where i can link a file to download on my server, without letting the client know where is the location? can i keep the location "invisible" while they download the file?

Thanks.
 
you can try that:
Code:
header("Content-type: application/exe"); // content-type can be different
$exefile = file_get_contents("/fromasecretsource/program.exe");
echo $exefile;
 
thanks toweter. but, how do i have like a link for them to download? if i use your script above, it will automatically open in the webpage, and not download it.

Wizard, could you please elaborate more on how to use mysql to hide it? do u mean that i have to get the link from a database ?

Thanks.

i found this script online....which has force-download.


<?php
$filename=""; // the name the file will have on client computer
$file_to_download=""; // the name the file has on the server (or an FTP or HTTP request)
$user_agent = strtolower ($_SERVER["HTTP_USER_AGENT"]);
header( "Content-type: application/force-download" );
if ((is_integer (strpos($user_agent, "msie"))) && (is_integer (strpos($user_agent, "win")))) {
header( "Content-Disposition: filename=".$filename);
} else {
header( "Content-Disposition: attachment; filename="$filename);
}
header( "Content-Description: File Transfert");
@readfile($file_to_download);
?>
 
Back
Top