Précédent   Forum des professionnels en informatique > PHP > Langage > Fichiers
Fichiers Forum d'entraide sur les fichiers avec PHP. Avant de poster -> FAQ fichiers et Sources fichiers
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 03/05/2007, 16h37   #1
Membre du Club
 
Inscription : avril 2007
Messages : 121
Détails du profil
Informations forums :
Inscription : avril 2007
Messages : 121
Points : 61
Points : 61
Par défaut télécharger un fichier jpg

Bonjour,
Dans mes pages html je fais un inculde de ce code pour telecharger des fichier de type jpg:
Code :
1
2
3
4
5
6
7
8
9
10
11
 
<?php
 
$fichier = $_GET['fichier'];
header('Content-disposition: attachment; filename="' . basename($fichier) . '"');
header('Content-type: application/octetstream');
header('Pragma: no-cache');
header('Expires: 0');
readfile($fichier);
 
?>
Le probleme c'est que lorsque mon fichier est un .php, j'ai ces erreurs :
Citation:
Warning: Cannot modify header information - headers already sent by (output started at /mnt/146/sda/1/8/audran12/Verneuil.php:3) in /mnt/146/sda/1/8/audran12/telechargement.php on line 4

Warning: Cannot modify header information - headers already sent by (output started at /mnt/146/sda/1/8/audran12/Verneuil.php:3) in /mnt/146/sda/1/8/audran12/telechargement.php on line 5

Warning: Cannot modify header information - headers already sent by (output started at /mnt/146/sda/1/8/audran12/Verneuil.php:3) in /mnt/146/sda/1/8/audran12/telechargement.php on line 6

Warning: Cannot modify header information - headers already sent by (output started at /mnt/146/sda/1/8/audran12/Verneuil.php:3) in /mnt/146/sda/1/8/audran12/telechargement.php on line 7
Comment puis-je faire pour telecharger??
audran12 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2007, 17h31   #2
Invité de passage
 
Inscription : mai 2007
Messages : 9
Détails du profil
Informations forums :
Inscription : mai 2007
Messages : 9
Points : 3
Points : 3
Je ne suis pas sur que cela viens de la mais il se peut que tu ai laissé des espaces avant ton header ou un quelque chose de ce genre
C'est une erreur tres fréquente : pas de html avant un header()
Code :
1
2
3
4
5
 
 
<html>
<?php
--
C'est pas bon

pas bon

Code :
1
2
3
4
 
 
<?php
echo 'toto';
pas bon

Je sais pas si je me suis bien expliqué
Mordanus est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2007, 22h13   #3
Membre du Club
 
Inscription : avril 2007
Messages : 121
Détails du profil
Informations forums :
Inscription : avril 2007
Messages : 121
Points : 61
Points : 61
c'est bon

Merci
audran12 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 03h03.


 
 
 
 
Partenaires

Hébergement Web