• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

hiding the filename for download by user

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
le_plop
Asked:
le_plop
  • 2
1 Solution
 
duerraCommented:
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
 
duerraCommented:
oh, sorry.  You would include that in a "download" page that is formatted.
0
 
carchitectCommented:
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
 
snoyes_jwCommented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now