[Gllug] PHP - no visible directory

Gundemarie Scholz spamyousilly at inbox.ru
Tue Nov 21 23:54:24 UTC 2006


ft wrote:
> > Hello,
> >
> > I have a problem/question with PHP.
> >
> > if you download a file, you click on a html-link. For the client,
> > the structure of the directories are visible.
> >
> > Is there a solution, to make it invisible, so that the client don't
> > see the directories?
> >
> > html-link on the website
> > <a href="index.php?file=file.pdf">Link for download</a>

Thinking some more about it... if the URL only contains the file name
without the complete path, how would the browser know about the
underlying directory structure?

> > PHP-script
> > <?
> > $dir = "./dir1/dir2/";
> > $download = $dir.$file;
> > # What is the command, to send the file to the client?

Something like this maybe?
header('Content-type: application/pdf');
header('Content-disposition: attachment; filename="file.php"');

See also http://de.php.net/header the last example before the user
contributed notes.

Regards,
Gunde

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list