Help with php...How to hide download path with php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
feartetsuo
Forum Newbie
Posts: 9
Joined: Tue Dec 21, 2004 9:25 am

Help with php...How to hide download path with php

Post by feartetsuo »

Hello, this is my first time posting here.
What I am trying to do is completely hide the full path of a download file when you highlight the link as well as when the download box comes up. So instead of seeing http://www.domain.com/username/folder/folder/file.zip, show only http://www.domain.com. I have tried using php scripts to do this but I am a noob when it comes to php and I can’t seem to get them to work. Any help would be greatly appreciated. Thanks.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

this is generally done by storing your images/downloads outside the root so the users cannot directly download it, and then you can create a function that will manually fetch what you are wanting to display/download

Code: Select all

<?php
function getfile($file)
{
$dir = 'user/path/images/';
return $dir.$file;
}
?>
That is obviously simplified, but I hope you get the point.
feartetsuo
Forum Newbie
Posts: 9
Joined: Tue Dec 21, 2004 9:25 am

Post by feartetsuo »

Ok thanks. I will try that out in a little bit. So I would just do the same things for multiple downloads? Or is there a way to list all the files in 1 script? Or to set up the downloads like download.php?file=fileToDownload. that would be my preferred way of setting up downloads.
Post Reply