File Viewer CodeIgniter

function view_file() {
        $id = $this->uri->segment(3);
        $file = realpath('./uploads/'.$id);
        header("Content-disposition: inline;filename=".$id);
        header('Content-Type: application/pdf');
        @readfile($file);
    }
Chief Max