Php file download function implementation .? Php *** file download function * @ paramstring $ fileName File Name * @ paramstring $ fileExt file suffix name * functiondownloadFile($fileName,$fileExt.txt) {if (empty ($ f /**
* File download function
* @ Param string $ fileName file name
* @ Param string $ fileExt file suffix name
*/
Function downloadFile ($ fileName, $ fileExt = '.txt ')
{
If (empty ($ fileName) return FALSE;
$ FileName. = $ fileExt;
$ FilePath = TEMI_UPLOAD_PATH. $ fileName;
$ File = fopen ($ filePath, "r ");
Header ("Content-type: application/octet-stream ");
Header ("Accept-Ranges: bytes ");
Header ("Accept-Length:". filesize ($ filePath ));
Header ("Content-Disposition: attachment; filename =". $ fileName );
Echo fread ($ file, filesize ($ filePath ));
Fclose ($ file );
}
?>
Http://www.bkjia.com/PHPjc/477902.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477902.htmlTechArticle? Php/*** file download function * @ param string $ fileName File Name * @ param string $ fileExt file suffix name */function downloadFile ($ fileName, $ fileExt =. txt) {if (empty ($ f...