la réponse est assez simple, @ Jon Stirling a publié ce billet que je tapais, mais je vais vous expliquer un peu plus pour vous
on a mis vos fichiers en dehors de votre répertoire public html,
EG cPanel configuration
user/public_html
/public_html/download.php
user/documents/
/documents/file.doc
/documents/file.pdf
@dhh a posté unde basefichier php cependant comme vous voulez forcer télécharger leurs choses que vous pouvez faire comme trouver et fournir le bon type mime ici est une extension sur son code quant à la meilleure façon de télécharger 1 forcer un fichier, et 2 permettent différents types de fichiers
download.php
//check users is loged in and valid for download if not redirect them out
// YOU NEED TO ADD CODE HERE FOR THAT CHECK
// array of support file types for download script and there mimetype
$mimeTypes = array(
'doc' => 'application/msword',
'pdf' => 'application/pdf',
);
// set the file here (best of using a $_GET[])
$file = "../documents/file.doc";
// gets the extension of the file to be loaded for searching array above
$ext = explode('.', $file);
$ext = end($ext);
// gets the file name to send to the browser to force download of file
$fileName = explode("/", $file);
$fileName = end($fileName);
// opens the file for reading and sends headers to browser
$fp = fopen($file,"r") ;
header("Content-Type: ".$mimeTypes[$ext]);
header('Content-Disposition: attachment; filename="'.$fileName.'"');
// reads file and send the raw code to browser
while (! feof($fp)) {
$buff = fread($fp,4096);
echo $buff;
}
// closes file after whe have finished reading it
fclose($fp);
PS voici abig liste des types MIME si vous voulez ajouter le support pour d'autres fichiers http://www.hansenb.pdx.edu/DMKB/dict/tutorials/mime_typ.php
C'est exactement ce que je cherchais, merci! – Mike