2016-07-25 110 views
0

我有这样的节目上传PDF文件在我的本地我的看法是无法加载在服务器上传的pdf文件。笨HMVC

<?php 
    // retrieve your info ecc. 
    $url = $content->PATH; 
    $filename = $content->FILE_NAME; 
    header('Content-type: application/pdf'); 
    header('Content-Disposition: inline; filename="' . $filename. '"'); 
    header('Content-Transfer-Encoding: binary'); 
    header('Accept-Ranges: bytes'); 
    @readfile($url); 
?> 

仅仅是明确

$content->PATH$content->FILE_NAME从数据库

$content->FILE_NAME数据$file_name = $file_data['file_name'];

$content->PATH = base_url().'uploads/pdf/'.$file_name;

现在它完美的作品在我的本地,但在服务器上,它看起来像这样

enter image description here

的链接,这是

$row[] = '<a href = "http://146.88.72.53/CaloocanCity/PDFuploads/pdffile/'.$info->ID_NUM.'/'.$info->DOC_NO.'/'.$info->FILE_NAME.'" class = "btn btn-sm btn-info pull-left fa fa-question-circle" title="Show File">&nbsp Show File</a>"; 

这个是什么错误?我该如何解决这个问题?

+0

也许它允许的错吗? – rad11

+0

在服务器上的pdf文件的回声路径....是base_url集? –

+0

这是什么“权限的错误”? –

回答

2

尝试用CI内置的下载辅助类

$this->load->helper('download'); force_download($file_name);