[Php-it] Download di file via header

Gianluca Baù gianluca at ihuri.it
Tue Jun 26 11:30:34 CEST 2007


Andrea Ambu wrote:

>1euro al giorno e questo spazio e' tuo. info at ziobudda.net
>___________FINE_____SPONSOR_______________________________
>
>  
>
>
> ------------------------------------------------------------------------
>
>
>
> On 19/06/07, *Gianluca Baù* <gianluca at ihuri.it 
> <mailto:gianluca at ihuri.it>> wrote:
>
>     Sbagliato, it works. Thanks
>
>
> Come hai fatto? Come si scrive l'header attachment?
>
> -- 
> Andrea

Ciao Andrea,
ecco il codice

/* Ricavo la grandezza del file */
$filesize = filesize($file_path);

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Content-type: application; filename=" . $file['Filename_real']);
header("Content-transfer-encoding: binary");
header("Content-Length: " . $filesize);
header("Content-disposition: attachment; filename=" . 
$file['Filename_real']);
header("Expires: 0");
header("Cache-control: no-cache, must-revalidate");
header("Cache-control: private");
header("Pragma: public");

saluti,

Gianluca


More information about the Php-it mailing list