Re: open/download file not under www-root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx] Sent: Tuesday, September 04, 2007 2:02 PM
To: trystano@xxxxxxx
Cc: george.pitcher@xxxxxxxxxxx; gustav@xxxxxx; php-windows@xxxxxxxxxxxxx
Subject: Re:  open/download file not under www-root

trystano@xxxxxxx 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


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux