/** * Get real path for file * * @param string $path * @return string */ public function getRealPath($path) { $path = realpath(str_replace('~', $this->request()->server()->get('DOCUMENT_ROOT'), $path)); if ($path === false) { $this->view->throwPageNotFound(); } return $path; }