je veux forcé un dl d'un fichier .txt
J'ai des messages d'erreur aux requetes "header"
voici mes fichiers :
telecharger.php
<?php
// infos du fichier
$fichier = 'W:\var\www\hello.txt';
$nom_fichier = 'hello.txt';
// téléchargement du fichier
header('Content-disposition: attachment; filename='.$nom_fichier);
header('Content-Type: application/force-download');
header('Content-Transfer-Encoding: fichier');
header('Content-Length: '.filesize($fichier));
header('Pragma: no-cache');
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
readfile($fichier);
?>
**********
et une partie de mon code html :
<a href="telecharger.php?nom_fichier=hello.txt&chemin=W:\var\www">Télécharger</a>
**********
voici mes messages d'erreur :
Warning: Cannot modify header information - headers already sent by (output started at W:\var\www\telecharger.php:1) in W:\var\www\telecharger.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at W:\var\www\telecharger.php:1) in W:\var\www\telecharger.php on line 8
Warning: Cannot modify header information - headers already sent by (output started at W:\var\www\telecharger.php:1) in W:\var\www\telecharger.php on line 9
Warning: Cannot modify header information - headers already sent by (output started at W:\var\www\telecharger.php:1) in W:\var\www\telecharger.php on line 10
Warning: Cannot modify header information - headers already sent by (output started at W:\var\www\telecharger.php:1) in W:\var\www\telecharger.php on line 11
Warning: Cannot modify header information - headers already sent by (output started at W:\var\www\telecharger.php:1) in W:\var\www\telecharger.php on line 12
Warning: Cannot modify header information - headers already sent by (output started at W:\var\www\telecharger.php:1) in W:\var\www\telecharger.php on line 13
Aidez moi svp, la soluce doit etre facile pour les experts