RazielReaver
Messages postés34Date d'inscriptionvendredi 2 avril 2004StatutMembreDernière intervention 9 juillet 2005
-
16 nov. 2004 à 14:18
astyax
Messages postés27Date d'inscriptionlundi 18 octobre 2004StatutMembreDernière intervention26 septembre 2011
-
16 nov. 2004 à 14:52
Bonjour,
Je commence a perdre patience :) avec c pb
Voila j'utilise un téléchargment forcé (application/force-download) dans le header de mon script et le téléchargment comme bien mais se fini prématurément. IE ne m'indique meme pas qu'il y a eu un pb. Il me dit téléhchargement terminé puis basta :)
Quand je vais chercher le fichier directement sans forcé le téléchargement c OK
Voila le script qui me force le télé :
Est-ce un pb rédibitoire liée au fait que l'on force un télé il me semble avoir rencontré ce pb sur certains autres site?
<?
$file_path=stripslashes($file_path);
if (is_file($file_path))
{
$file=basename($file_path);
$path=dirname($file_path);
switch (strtolower(strrchr($file,".")))
{
case ".gz": $type = "application/x-gzip"; break;
case ".tgz": $type = "application/x-gzip"; break;
case ".zip": $type = "application/zip"; break;
case ".pdf": $type = "application/pdf"; break;
case ".png": $type = "image/png"; break;
case ".gif": $type = "image/gif"; break;
case ".jpg": $type = "image/jpeg"; break;
case ".txt": $type = "text/plain"; break;
case ".htm": $type = "text/html"; break;
case ".html": $type = "text/html"; break;
default: $type = "application/octet-stream"; break;
}
header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename="$file"");
header("Content-Transfer-Encoding: $type\n"); // Surtout ne pas enlever le \n
header("Content-Length: ".filesize($path."/".$file) . "\n");
header("Expires: 0");
readfile($path."/".$file);
}
?>