Hey,

Well sure there is:

$fp = fopen($filename, 'r') or die('damn');
$read = fread($fp, filesize($filename)) or
die('damn');
$filestr = basename($filename);

header("Content-Disposition: attachment;
filename=$filestr");
header("Content-Type: application/octet-stream");

echo $read;
exit;

Neat And Clean!

Your authentication can be done above that piece of
code, you then open the file, read it through send the
filename download as $filestr, and the contents 
$read.

Simple!


--- Thorsten Gutermuth <[EMAIL PROTECTED]>
wrote: > Hi!
> I'm trying to make some mpegs available only to
> people who authenticated
> themselves using php. But all the solutions I found
> somewhat unpleasant
> because I uses chmod to set the file attributes to
> u=rw and then
> used either
> i)
>
readfile("ftp://name:password@server/path//test.mpeg");
> 
> or
> 
> ii) header ("Location:
> ftp://name:password@server/path/test.mpeg");
> 
> But in case
> i) the browser asks if I want to download the file
> or view it. If I choose
> view the browser suggests to save the movie as
> myscript.php and if I choose
> view it ´doesn't display anything.
> 
> ii.) the browser displayes my username and password
> in the statusbar
> 
> And in both cases it downloads the whole file(I
> guess cause I use ftp)
> before starting the mpeg programm(where nothing
> happens afterwards in case
> i)
> 
> Is there a better way? ´Like telling the server via
> http my login data and
> sending the file to the users browser?
> 
> Thanks
> Thorsten
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> 


=====
To find out more about me : http://www.geocities.com/mimodit
My bookmarks are available @ http://mukul.free.fr

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to