[Gllug] PHP - no visible directory
sas.18752793 at bloglines.com
sas.18752793 at bloglines.com
Wed Nov 22 09:05:40 UTC 2006
--- Greater London Linux User Group <gllug at gllug.org.uk wrote:
On Tue, Nov
21, 2006 at 11:31:48PM +0000, 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>
> >
> > PHP-script
> > <?
> > $dir = "./dir1/dir2/";
> > $download = $dir.$file;
> > # What is the command, to send the file
to the client?
>
> You need to set the content (mime) type & then send
the data, eg:
> header('Content-type: application/pdf');
> readfile($download);
It might be worth noting that some versions of PHP (including early versions
of PHP 5.0) had a bug where readfile() would stop after around 2MB.
Simon
-------------- next part --------------
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list