PHP ReadFile functions
ReadFile
(PHP 4, PHP 5)
ReadFile-Output a file
Describe
International ReadFile (string $ file name [, Boolean $ use_include_path = False [, resource $ background]])
Reads the file and writes it to its output buffer.
Parameters
Filename
The file is read.
Use_include_path
You can use the optional second parameter set to TRUE if you want to search for the file in the Include_path also.
Background
Background flow resource.
return value
The number of bytes returned to read the file. If an error occurs, false, unless the returned function is called @ ReadFile (), the error message is printed.
Instance
For example # 1 forced download using ReadFile ()
$file = ' monkey.gif ';
if (file_exists ($file)) {
Header (' Content-description:file Transfer ');
Header (' Content-type:application/octet-stream ');
Header (' content-disposition:attachment; Filename= '. basename ($file));
Header (' content-transfer-encoding:binary ');
Header (' expires:0 ');
Header (' Cache-control:must-revalidate, post-check=0, pre-check=0 ');
Header (' Pragma:public ');
Header (' Content-length: '. FileSize ($file));
Ob_clean ();
Flush ();
ReadFile ($file);
Exit
}
?>
http://www.bkjia.com/PHPjc/445475.html www.bkjia.com true http://www.bkjia.com/PHPjc/445475.html techarticle php readfile function ReadFile (PHP 4, PHP 5) ReadFile-Output A file description of international ReadFile (string $ file name [, Boolean $ use_include_path = False [, resource $ background. ..