/** * function return set file to user * * @param File $oFile file object * * @param bool $dispositionInline if true then diposition is 'inline' else * disposition is 'attachment', default - * true (disposition 'inline') * @return bool is file sent */ function downloadFile($oFile, $dispositionInline = false) { if (empty($oFile)) { $this->farrErrors[] = "File not set"; return false; } if (!$oFile->getFileMimeType()) { $this->farrErrors[] = "File mime type not set"; return false; } $disposition = $dispositionInline ? $disposition = 'inline' : ($disposition = 'attachment'); header('Content-type: ' . $oFile->getFileMimeType()); header('Content-Disposition: ' . $disposition . '; filename="' . $oFile->getFileUserName() . '"'); header('Content-Length: ' . $oFile->getFileSize()); readfile($oFile->getFilePath() . $oFile->getFileName()); return true; }