This is a discussion on Refer to a file outside the website tree for downloading purposes within the PHP Language forums, part of the PHP Programming Forums category; Hello, I'm using Linux Redhat 8.0 (LAMP). I have a file tx.zip , that is placed in /tmp. ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello,
I'm using Linux Redhat 8.0 (LAMP). I have a file tx.zip , that is placed in /tmp. Now I want people to be able to download this file without copying it to the website tree Can I make a reference like http://www.website.com/../../../tmp/tx.zip if the root of my website is /var/www/html/Vwebsite ? Due to restrictions, I cannot copy the file to /var/www/html/Vwebsite Any solutions? Thanks Ernst |
|
|||
|
While the city slept, Ernst (iceking@xs4all.nl) feverishly typed...
> Hello, > > I'm using Linux Redhat 8.0 (LAMP). > I have a file tx.zip , that is placed in /tmp. > Now I want people to be able to download this file without copying it > to the website tree > Can I make a reference like http://www.website.com/../../../tmp/tx.zip > if the root of my website is /var/www/html/Vwebsite ? No. The URI is "relative" to the root of the website folder, not the system. > Due to restrictions, I cannot copy the file to /var/www/html/Vwebsite > Any solutions? Can you make an alias to /tmp in your httpd.conf file? You would be well advised to talk to your system admin about this first, though! Possible security issues. As an alternative, can you upload the file to some other webspace and link to that? Cheers, Nige -- Nigel Moss http://www.nigenet.org.uk Mail address not valid. nigel@DOG.nigenet.org.uk, take the DOG. out! In the land of the blind, the one-eyed man is very, very busy! |
|
|||
|
> I'm using Linux Redhat 8.0 (LAMP).
> I have a file tx.zip , that is placed in /tmp. > Now I want people to be able to download this file without copying it to > the website tree > Can I make a reference like http://www.website.com/../../../tmp/tx.zip > if the root of my website is /var/www/html/Vwebsite ? > Due to restrictions, I cannot copy the file to /var/www/html/Vwebsite > Any solutions? You need two things: 1 - What To Do: http://www.faqs.org/rfcs/rfc1806.html & http://www.faqs.org/rfcs/rfc2616 2 - How To Do It: http://us2.php.net/manual/en/function.header.php Essentially, your header will look something like the following: header("Content-disposition: attachment; filename=/tmp/tx.zip"); header('Expires: Mon, 26 Nov 1962 00:00:00 GMT'); header("Last-Modified: " . gmdate("D,d M Y H:i:s") . " GMT"); header('Pragma: no-cache'); or for IE : header("Content-disposition: attachment; filename=/tmp/tx.zip"); header('Expires: Mon, 26 Nov 1962 00:00:00 GMT'); header("Last-Modified: " . gmdate("D,d M Y H:i:s") . " GMT"); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); ____________________________________ Wil Moore III, MCP | Integrations Specialist | Assistant Webmaster |