|
Dernière réponse | |
---|---|
Sujet : Encore des pb de download de fichier ....... | |
Mara's dad | Bon, bein je verrai çà se soir ! Google est bloqué là où je suis ! :fou: |
Aperçu |
---|
Vue Rapide de la discussion |
---|
Mara's dad | Bon, bein je verrai çà se soir ! Google est bloqué là où je suis ! :fou: |
persnet | http://groups.google.com/groups?q= [...] isdnet.net |
Mara's dad | Je doute que le problème vienne du serveur si çà marche avec Netscape ?
Mais sait-on jamais ! C'est quoi ta source d'infos pour les headers à coder pour ton truc ? |
persnet | Version IE 5.0
Sous W95 Avec un serveur apache sous sunSolaris Merci pour ta patience |
Mara's dad | Ben là je peux rien pour toi !
C'est quoi ta version IE ? Moi je suis sous NT4.0 avec IE5.0. |
persnet | Meme ca ca marche pas ..........
Getting fiole information ExpoApp.php from ............ Et pas toto.csv |
Mara's dad | Elle sort d'où cette variable $Tabp ?
Sinon, t'as testé çà : <? $Lig = "Bonjour, c'est moi !\nEncore un test !"; header("Content-disposition: attachment; filename=toto.csv" ); header("Content-type: application/octetstream" ); header("Pragma: no-cache" ); header("Expires: 0" ); header("Content-Length: " . strlen($Lig)); echo $Lig; ?> [edtdd]--Message édité par Mara's dad--[/edtdd] |
persnet | J'ai du transformer un peu mon code parce que j'ai voulu integrer les sessions a la place de mon fichier temporaire
Par contre le download ne marche tjs pas / Dans la boite de dialogue : You have choosen to download ExpoApp.php from ....->Pas le bon nom de fichier (essai.csv) et lorsque je fais save il ne se passe rien : getting file information ExpoApp.php from .... Programme appelant : print('<a href="./ExpoApp.php"><img src="../imglg/Expo.gif" border=0 ALIGN=ABSBOTTOM></a>');"ExpoApp.php" 16 lignes, 440 caractères <? $trans = get_html_translation_table (HTML_ENTITIES); $trans = array_flip ($trans); $Lig = strtr($Tabp[0][0], $trans); $Lig = trim(Str_replace('"','""',$Lig)); $Lig = Str_replace('.',',',$Lig); header("Content-disposition: attachment; filename=Essai.csv" ); header("Content-type: application/octetstream" ); header("Pragma: no-cache" ); header("Expires: 0" ); header("Content-Length: " . strlen($Lig)); echo $Lig; ?> |
Mara's dad | Les headers ne doivent pas être au début !
Ils doivent être avant toutes sortie genre code HTML, echo, print... Relis mon précédent post, ce que j'ai testé marche bien, et les headers ne sont pas au tout début ! Relis le message d'erreur : Warning: Cannot add header information - headers already sent by (output started at /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php:2) in /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php on line 9 Il te dis qu'en ligne 9 il peux pas mettre un header a cause qu'ils ont déjà été envoyés à cause d'un OUTPUT en ligne 2 ! Et en ligne 2 t'as un OUTPUT ! ! ! Pourquoi ? Parceque $Tabf = file($NomFic); te génère un warning ! Warning: file("" ) - Error 0 in /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php on line 2 Et un Warning, c'est un OUTPUT ! ! ! Conclusion, essaye le script avec un nom de fichier dans $NomFic ! |
persnet | Messages recus:
J'avais cru comprendre que les headers devaient etre au debut Warning: file("" ) - Error 0 in /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php on line 2 Warning: Cannot add header information - headers already sent by (output started at /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php:2) in /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php on line 9 Warning: Cannot add header information - headers already sent by (output started at /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php:2) in /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php on line 10 Warning: Cannot add header information - headers already sent by (output started at /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php:2) in /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php on line 11 Warning: Cannot add header information - headers already sent by (output started at /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php:2) in /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php on line 12 Warning: Cannot add header information - headers already sent by (output started at /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php:2) in /products/users/poplg/html/perdrixs/StatAppel/ExpoApp.php on line 13 |
Mara's dad | J'ai testé çà :
<? $Lig = "Bonjour, c'est moi !\nEncore un test !"; header("Content-disposition: attachment; filename=toto.csv" ); header("Content-type: application/octetstream" ); header("Pragma: no-cache" ); header("Expires: 0" ); header("Content-Length: " . strlen($Lig)); echo $Lig; ?> Et çà marche bien. Un question : Tu met : header("Content-Length: ".$file_length); Mais la longueur n'est plus la bonne, c'est la longueur de $Lig qu'il faut mettre non ? Donc : <? $Tabf = file($NomFic); $trans = get_html_translation_table (HTML_ENTITIES); $trans = array_flip ($trans); $Lig = strtr($Tabf[0], $trans); $Lig = trim(Str_replace('"','""',$Lig)); $Lig = Str_replace('.',',',$Lig); header("Content-disposition: attachment; filename=$NomFicCsv" ); header("Content-type: application/octetstream" ); header("Pragma: no-cache" ); header("Expires: 0" ); header("Content-Length: " . strlen($Lig)); echo $Lig; ?> Qu'est ce que t'en pense ! |
Mara's dad | Ben c'est vrai que là je comprend pas.
T'est sûr pour "Content-type: application/octetstream", c'est pas plustôt du texte ? Je vois pas ce que çà change mais bon... J'essaye, et si je trouve quelque-chose... |
persnet | Tu abdiques? |
persnet | J'va essayer d'etre clair : Appel :print('<a href="./ExpoApp.php?NomFic='.$Fichier.'&NomFicCsv='.$Fichier.'.csv"> Je voudrais que le fichier genere : $Nomfic (voir l'autre topic) puisse etre reconverti en format csv(; comme separateur) et que l'utilisateur puisse le sauvegarder sur sa machine . Actuellement, mon code marche avec Netscape Avec IE : la boite de dialogue file download s'affiche avec possibilite de sauvegarder . Lorsque je sauvegarde , il m'affiche une autre boite : message Getting file information Fichier.csv from .... et rien ne se passe. Est-ce-que c'est plus clair ? |
Mara's dad | ENCORE UNE FOIS, Désolé, mais sans exemple, de ce que tu as en entrée, de ce que tu attend en sortie, de ce qui marche, et de ce qui marche pas...
Je pourrai auusi bien te répondre : Tiens, vl'a un bout d'code qui marche : <?php echo( "Hello World !" ); ?> |
persnet | J'ai toujours de pb pour telecharger un fichier...
Voici mon code si qqun a une idee <? header("Content-disposition: attachment; filename=$NomFicCsv" ); header("Content-type: application/octetstream" ); header("Pragma: no-cache" ); header("Expires: 0" ); header("Content-Length: ".$file_length); $Tabf = file($NomFic); $trans = get_html_translation_table (HTML_ENTITIES); $trans = array_flip ($trans); $Lig = strtr($Tabf[0], $trans); $Lig = trim(Str_replace('"','""',$Lig)); $Lig = Str_replace('.',',',$Lig); echo $Lig; ?> |