By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,722 Members | 1,227 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

Refer to a file outside the website tree for downloading purposes

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
While the city slept, Ernst (ic*****@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. ni***@DOG.nigenet.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!
Jul 17 '05 #2

P: n/a
> 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
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.