?
Solved

hiding the filename for download by user

Posted on 2003-03-07
5
Medium Priority
?
222 Views
Last Modified: 2009-12-16
Another incredibly common question, I'm sure.

I've found so many resources discussing this, but they're all so different that it makes it difficult to know (or test) to see which works.

I would like a user to go to an address on my server eg "www.blah.ccom/download.php?filename=blah.zip" and their browser starts downloading the file without them knowing the actual location of the file on the server.

I understand that it has something to do with headers, but apart from that, I'm befuzzled from the shear amount of bad examples on the web!

Preferably should work with IE, using standard install of PHP 4.3.1.

Regards,
Pip
0
Comment
Question by:le_plop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 4

Expert Comment

by:duerra
ID: 8091055
Try this:

require_once('location/blah.zip');

I'm not positive that it will work, but it's worth a shot, and it's only one line of code. ;)
0
 
LVL 4

Expert Comment

by:duerra
ID: 8091061
oh, sorry.  You would include that in a "download" page that is formatted.
0
 
LVL 6

Accepted Solution

by:
carchitect earned 100 total points
ID: 8092913
yeah ok
why don't yo do one thing
lets say you created links like

www.blah.ccom/download.php?filename=blah1.zip 
www.blah.ccom/download.php?filename=blah2.zip 
www.blah.ccom/download.php?filename=blah3.zip etc.

now in download.php
write this
<?php
if($filename=="blah1.zip")
  header("Location : blah1.zip"); //specify location here
?>

i hope will work for you..

regards
0
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 11934145
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: carchitect {http:#8092913}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

snoyes_jw
EE Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question