Page 1 of 1

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

Posted: Tue Dec 21, 2004 9:33 am
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.

Posted: Tue Dec 21, 2004 9:39 am
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.

Posted: Tue Dec 21, 2004 9:56 am
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.