eg, if they goto
www.domain.com/file.php?file=requiredfile
they get given that assosciated file
i am ok with using an array or somehting else to tell PHP the right file to
send, just not how to make it send
thanks
jon
there's two possible ways to do this;
one would be to 'fopen()' the target file and pipe the contents back
to the user, or probably the easiest would be to just redirect to the
target file:
[start-of 'file.php']
<?
header( "Location: $file" );
?>
[end-of 'file.php']
make sure there's no whitespace before the opening <? tag
HTH,
m.
--
#!/usr/local/bin/perl
print 'mailto:'.join('@',('emdee','cwcom.net'));
One method to do it is:
<?
readfile("$dir/$file");
?>
Where $file is the file that the user is requesting,
and $dir is the directory where it's located on your
server.
There are a few extra things that you might need to
do for the download. For example, if the $file is
not an HTML file, then you will have to set the
content-type. You must do this BEFORE your call
to readfile(). Example:
<?
header("Content-Type: image/gif");
readfile("$dir/$file");
?>
Another thing that you might want to do is to
force the browser to display a "Save File" box,
or to control the default name of the file on the
user's machine. That's done with this header:
<?
header("Content-Disposition: attachment; filename=$file");
readfile("$dir/$file");
?>
If you don't use this header, then the browser will
probably always save the file as the name of your
PHP script -- which is usually not what you want.
JL
Spadger M ClogToe <spa...@poo.co.uk> wrote in message
news:tglaier...@corp.supernews.co.uk...