Posted by Alvaro G Vicario on 06/20/05 19:59
*** dspohn wrote/escribió (20 Jun 2005 09:42:24 -0700):
> Is there a way, without the webserver
> creating a new file name "document_specs_ver2.doc" to have the file
> download named "document_specs_ver2.doc".
Sure. Rather than linking to files, link to a download script. This example
is for PDF files and $folder is a directory outside the web server root,
but it can be easily modified for different usages:
$folder='/home/foo/files';
$file='bar.pdf';
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename=' . $file . ';');
header('Content-Length: ' . filesize($folder . '/' . $file));
readfile($folder . '/' . $file);
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
[Back to original message]
|