00001 <?php
00003
00004
00005
00006
00007
00008
00010
00020
00021 define('SENDFILE_ATTACHMENT', 'attachment');
00022 define('SENDFILE_INLINE', 'inline');
00023
00024
00035 class FLEA_Helper_SendFile
00036 {
00044 function sendFile($serverPath, $filename, $mimeType = 'application/octet-stream')
00045 {
00046 header("Content-Type: {$mimeType}");
00047 $filename = '"' . htmlspecialchars($filename) . '"';
00048 $filesize = filesize($serverPath);
00049 $charset = FLEA::getAppInf('responseCharset');
00050 header("Content-Disposition: attachment; filename={$filename}; charset={$charset}");
00051 header('Pragma: cache');
00052 header('Cache-Control: public, must-revalidate, max-age=0');
00053 header("Content-Length: {$filesize}");
00054 readfile($serverPath);
00055 exit;
00056 }
00057 }