IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

[Système] problème Cannot modify header information


Sujet :

Langage PHP

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    121
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 121
    Points : 98
    Points
    98
    Par défaut [Système] problème Cannot modify header information
    Bonjour,

    Je voudrais qu'un telechargement se lance lorque je clic sur un lien :

    code HTML:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <?php 
    include ("./compteur-live/compteur-live.php");
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    	<head>
    		<title>Site de Fan | Los Globos</title>
    		<meta http-equiv="Content-Type" content="application/xhtml+xml" />
    		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    		<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
    	</head>
    	<body>
    	<div id="pageBody">
    		<div id="outer-container">
    			<div id="container">
    			<div id="header">
    				<a href="http://www.losglobos.fr"><div id="headerLeft"></div></a>
    				<div id="headerRight"><h1>Toutes les videos de<br /><span class="highlight">LOS GLOBOS</span></h1></div>
    			</div>
    			<div id="headerNav">
    					<div id="centerNav">
    					<ul>
    							<li><a href="index.php">Home</a></li>
    							<li id="current"><a href="Orleans.php">Orleans</a></li>
    							<li><a href="Verneuil.php">Verneuil</a></li>
    							<li><a href="Azay.php">Azay sur Indre</a></li>
    					</ul>
    					</div>
    			</div>
    			<div id="content">
    				<div align='center'>
    					Video concert de los globos a Orleans(45) : <br>
    					<a href="telechargement.php?fichier=Orleans_1.MOV">Orléans 1</a><br>
    					<a href="telechargement.php?fichier=Orleans_2.MOV">Orléans 2</a><br>
    					<a href="telechargement.php?fichier=Orleans_3.MOV">Orléans 3</a><br>
    					<a href="telechargement.php?fichier=Orleans_4.MOV">Orléans 4</a><br>
    					<a href="telechargement.php?fichier=Orleans_5.MOV">Orléans 5</a><br>
    					<a href="telechargement.php?fichier=Orleans_6.MOV">Orléans 6</a><br>
    					<a href="telechargement.php?fichier=Orleans_7.MOV">Orléans 7</a><br>
    					<a href="telechargement.php?fichier=Orleans_8.mpg">Orléans 8</a><br><br>
    				</div>
    				Et pour tous ceux qui ne savent comment on fait la chouille chez les JOC : 
    				<I><H3>Bientot les Videos...</H3></I>
     
    			</div>
    			<div id="footer">
    				&copy; Copyright LosGlobos 2007, All Rights Reserved.
    			</div>
    		</div>
    	</div>
    	<P align=CENTER><script type="text/javascript" src="http://www.abcompteur.com/cpt/?code=4/5/7135/5/1&ID=227709"></script><P>
    </div>
    </body>
    </html>
    Voici le code php de telecharger.php :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    <?php
     
    $fichier = $_GET['fichier'];
    echo $fichier;
    header('Content-disposition: attachment; filename="' . basename($fichier) . '"');
    header('Content-type: application/octetstream');
    header('Pragma: no-cache');
    header('Expires: 0');
    readfile($fichier);
     
    ?>
    et voila ce que cela me retourne
    Orleans_1.MOV
    Warning: Cannot modify header information - headers already sent by (output started at /mnt/146/sda/1/8/audran12/telechargement.php:4) 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/telechargement.php:4) 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/telechargement.php:4) in /mnt/146/sda/1/8/audran12/telechargement.php on line 7

    Warning: Cannot modify header information - headers already sent by (output started at /mnt/146/sda/1/8/audran12/telechargement.php:4) in /mnt/146/sda/1/8/audran12/telechargement.php on line 8
    Merci de votre aide

  2. #2
    Membre averti Avatar de Asmodean
    Profil pro
    Inscrit en
    Février 2006
    Messages
    311
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 311
    Points : 378
    Points
    378
    Par défaut
    Tu fais un echo avant les fonctions header donc je ne suis pas sur qu'il aime ça, comme header et session_start on besoin d'être appelé avant tout affichage de texte.

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    121
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 121
    Points : 98
    Points
    98
    Par défaut
    Quand j'enleve le echo, je n'ai plus ce message d'erreur.
    Par contre mon telechargement se lance mais je n'ai pas la taille de mon fichier. Ce qui ne permet pas d'avoir de barre de progression de mon telechargement.

    Comment resoudre ce probleme?

  4. #4
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    121
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 121
    Points : 98
    Points
    98
    Par défaut
    Je voudrais preciser que j'utilise firefox comme navigateur et que dans ma fenetre de telechargement, il est ecrit : size unknow

Discussions similaires

  1. [Système] Warning: Cannot modify header information
    Par white_tiger dans le forum Langage
    Réponses: 14
    Dernier message: 20/02/2008, 17h16
  2. Cannot modify header information
    Par nerixm dans le forum Langage
    Réponses: 4
    Dernier message: 19/09/2006, 22h29
  3. Réponses: 5
    Dernier message: 04/09/2006, 15h13
  4. Cannot modify header information
    Par rane dans le forum Langage
    Réponses: 5
    Dernier message: 29/03/2006, 14h32
  5. Warning: Cannot modify header information
    Par neXistPa dans le forum Langage
    Réponses: 9
    Dernier message: 16/02/2006, 12h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo