Refer to a file outside the website tree for downloading purposes

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. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-21-2004
Ernst
 
Posts: n/a
Default Refer to a file outside the website tree for downloading purposes

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


Reply With Quote
  #2 (permalink)  
Old 10-21-2004
nice.guy.nige
 
Posts: n/a
Default Re: Refer to a file outside the website tree for downloading purposes

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!


Reply With Quote
  #3 (permalink)  
Old 10-21-2004
 
Posts: n/a
Default Re: Refer to a file outside the website tree for downloading purposes

> 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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:14 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0