RE: [PHP-WIN] open/download file not under www-root
| From: | Gustav Wiberg | Date: | Wed, 05 Sep 2007 10:26:00 +0000 |
| Subject: | RE: [PHP-WIN] open/download file not under www-root | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-28427@lists.php.net to get a copy of this message | ||
Hi there!
Thank you! It worked so fine.. Cool! :-)
Best regards
/Gustav Wiberg
-----Original Message-----
From: Armando [mailto:dijital@shaw.ca]
Sent: Wednesday, September 05, 2007 4:10 AM
To: Gustav Wiberg
Cc: 'Stut'; 'trystano@aol.com'; 'george.pitcher@ingenta.com';
'php-windows@lists.php.net'
Subject: Re: [PHP-WIN] open/download file not under www-root
As long as the user that Apache is running under has NTFS read
permissions to the target folder, then you should have no problems. A
quick and dirty force method that I use would be something like this:
$file = "x:\\path\\to\\the\\file.pdf";
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Length: ' . filesize($file));
header('Content-Disposition: attachment; filename=' . basename($file));
readfile($file);
Note the double backslashes! Cheers.
Armando
Gustav Wiberg wrote:
> Hi Stut!
>
> Exactly what does that mean? Do you have any references? Please send :-)
>
> Best regards
> /Gustav Wiberg
>
>
> -----Original Message-----
> From: Stut [mailto:stuttle@gmail.com]
> Sent: Tuesday, September 04, 2007 2:02 PM
> To: trystano@aol.com
> Cc: george.pitcher@ingenta.com; gustav@hmn.se; php-windows@lists.php.net
> Subject: Re: [PHP-WIN] open/download file not under www-root
>
> trystano@aol.com wrote:
>> I thought accessing files/directories above the www-root via the web was impossible???
>
> Directly yes, but you can proxy it through a server-side script.
>
> -Stut
>
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.485 / Virus Database: 269.13.5/990 - Release Date: 2007-09-04 22:36