|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
newbie_php Smarty n00b
Joined: 11 Dec 2007 Posts: 1
|
Posted: Tue Dec 11, 2007 12:55 pm Post subject: page de téléchargement avec smarty |
|
|
bonjour,
je suis nouveau sur ce forum et débutant en php
Mon probleme est le suivant.
J'ai une page qui me permet de lancer le téléchargement de donnée, le code est le suivant :
Code: |
{php}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=\"nonfichier.csv\";" );
{/php}
{foreach item=col from=$colums}{$columsDef[$col].titreCol};{/foreach}
{foreach item=compte from=$comptes}
{foreach item=col from=$colums}{$compte.$col};{/foreach}
{/foreach}
|
Ma question est en fait un probleme avec Internet Explorer.
Quand je télécharge mon fichier j'ai la fenêtre IE qui reste à l'écran.
Comment faire pour la refermer ?
J'ai essaye de mettre une founction java dans le tpl mais cela me met des erreurs...
Comment puis je faire SVP ?? |
|
Back to top |
|
Vynka Smarty Rookie
Joined: 30 Apr 2003 Posts: 17 Location: Belgium
|
Posted: Mon Dec 24, 2007 3:10 pm Post subject: |
|
|
Le problème ne vient peut-être de l'ordre d'interprétation du code. Perso, je te conseillerais de lancer tes header depuis PHP et une fois lancer de faire un display de ton fichier généré.
Code: |
header("Content-disposition: attachment; filename=$Fichier_a_telecharger");
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: $type\n"); // Surtout ne pas enlever le \n
header("Content-Length: ".filesize($chemin . $Fichier_a_telecharger));
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
header("Expires: 0");
$smarty->display('mon_template_de_fichier.tpl'); exit(0);
|
_________________ Au pays des Gloups!
http://www.wishlist.lu |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|