Re: [PHP] Change displayed file name to download

2010-03-14 Thread Peter Lind
You can set the name to display as you see fit, just change $filename to your liking right before the header() call. If you just want to cut the path, use basename($filename) Regards Peter On 14 March 2010 21:29, Php Developer wrote: > Hi, > > I'm using the following code: >

Re: [PHP] Change displayed file name to download

2010-03-14 Thread Kim Madsen
Hi Make a $new_filename and put that in the header: $neW_filename = "downloadfile." . $filetype; header("Content-Disposition: attachment; filename=$new_filename"); (the content of the file is now in $content, so if you like you could also change the value of $filename if you preferrer that) Y

[PHP] Change displayed file name to download

2010-03-14 Thread Php Developer
Hi, I'm using the following code: $fp = fopen($filename, 'r+'); $content = fread($fp, filesize($filename)); fclose($fp); header("Content-type: application/msword"); header("Content-Disposition: attachment; filename=$filename"); echo $content; exit; ___