473,749 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 17 '05 #1
2 3904
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.nigen et.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!
Jul 17 '05 #2
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1929
by: wackyphill | last post by:
Is there a way to code it so that you can transmit a file to a client programatically so that you could send it a file that is not part of your website? Like if my site is in c:\inetpub\mySite Is there a way I can use like FileStream and read in a file from c:\ and then somehow transmit it to the client. (Purpose being to force the user to go thru the website to access files and stop someone from directly putting the url of the file...
1
2200
by: user2008 | last post by:
Hi all, I want to track how many times visitor download file from my website, for example, when visitor click on a download link, a ASPX page will be requested, after that it will redirect to a file stored on my web site, final visitor will see open/save file dialog, how to do that, or is there an example code do this work? thank you,
14
2192
by: nd02tsk | last post by:
Hello Why is it that PostgreSQL chooses to have features like replication, fulltext indexing and GIS maintained by others outside of the sourcetree? I appreciate any answers. Thank you. Tim
3
5397
by: den 2005 | last post by:
Hi everybody, I like to allow user to select and browse to which location to save the pdf file of a crystal report viewed on a web page, how can i do this in ASP.Net? I need to get the path selected from dialog box. Thanks. Note: Using VS 2002 den2005
6
2050
by: Ozz | last post by:
Hi there, I have a link on my web page. When clicked, opens up a pdf file that is stored on my server. Every file is specific to a user's user name and I don't want users to see each other's files. For example: When User1 clicks on the link, it opens up http://mydomain.com/files/user1.pdf and when User2 clicks on the link, it opens up http://mydomain.com/files/user2.pdf.
6
414
by: rony_16 | last post by:
Hi, I have problem with downloading a file using WebRequest and HttpWebResponse. Inorder to download this file i need to call to url that tells to prepare the file for download, and then i call to another url that downloads the file. I have a problem with that because: 1. i do not know when the server finished the preparetion. 2.i checked the HttpStatusCode but he doen't changes
6
2210
by: Emmanuel Petit | last post by:
First of all I am rather new into PHP. I use php 5 and I am putting together a web site for a local association I belong too. Most of the site is okay, except for this problem : I need to be able for the member of the site to upload files (gif, jpg or pdf). After reading a lot about the danger of file uploading, I decided to create a folder at the root of the web server. The upload of the files goes on without any problem, but when i...
4
2075
by: Bob Altman | last post by:
Hi all, When I create a new website (click on "Create: Website" from the start page), I'm prompted for the location of the project files, but VS 2005 always creates a SLN file under the Visual Studio "Projects" directory tree. Is there an easy way to create a website project such that the SLN file is in the same place as the rest of the project files? Is this the same way that VS 2008 works? TIA - Bob
1
47476
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8256
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6800
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.