For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > August 2005 > Re: Downloading a file AS...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Downloading a file AS...
lowlevel

2005-08-31, 7:55 am

hello,
you can do that with this :
<?php
$file='abc.zip';
$filename='xyz.zip';
header("Content-type: application/force-download");
header("Content-Length: ".filesize($file));
header("Content-Disposition: attachment; filename=".$filename);
readfile($file);
?>

best regards...
JC
<talthen.z-serwera.o2@nospam.pl> a écrit dans le message de news:
df45jf$e6k$1@atlantis.news.tpi.pl...
> Hello,
> I have a file on the server named abc.zip but I would like the visitors to
> download this file as xyz.zip.
> How to do this the easiest way?
>
> Regards,
> Talthen
>



2005-08-31, 6:55 pm

"lowlevel" <jcg@netcourrier.com>
> hello,
> you can do that with this :


Thanks, It should do fine :]

Regards,
Talthen


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com