Hi,
I have just started using PHP's file operators...and as you can guess need a
little help

I am using the example from the online manual:
http://de3.php.net/manual/en/function.readfile.php

to read a file that is in a .htaccess protected folder and pop a download
box to the client.

Surprisingly, after screwing around with the example code for 2 mins I got
it working on IE and NN.
Opera have always had one problem...instead of outputting somefile.zip it
saves it as myPHPfileName.php
and this is what it passes on to Download Accelerator Plus (DAP)

1. I am sure I am not the only one who noticed this...so...how did you
tackle it?

2. Which is better for large files (5-8mb), readfile or fpassthru or.....etc
?

3. and last question is, in this line: header( "Content-Description: File
Transfert");
why do you have the "t" at the end of "Tranfer" ???

Thanks in advance.

(Below is the code that I am using.)

Cheers,
-Ryan
P.S, I know there are security issues when using readfile and fpassthru and
will take some precautions later but for this example I left it open.


* * * * Code * * * *
<?php
$the_filename="KeyMaker203.zip";
$filename=$the_filename; // the name the file will have on client computer
$file_to_download="/home/public_html/testing/KeyMaker203.zip";
$user_agent = strtolower ($_SERVER["HTTP_USER_AGENT"]);
header( "Content-type: application/force-download" );
if ((is_integer (strpos($user_agent, "msie"))) && (is_integer
(strpos($user_agent, "win"))))
{header( "Content-Disposition: filename=".$filename);
}else{header( "Content-Disposition: attachment; filename=".$filename);
 }
header( "Content-Description: File Transfert");
@readfile($file_to_download);
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to