Codeigniter上传不工作在linux上


codeigniter upload not working on linux

我正在使用CodeIgniter 2.2.0开发一个应用程序。在我的应用程序中,用户将能够上传pdf文件到服务器。

我在接口上使用uploadifive.js,我也有一个控制器,首先创建文件将要存储的目录结构。

在我的本地主机(W7和Apache)目录上创建的一切都很好,文件名被加密等等。在我的生产服务器Ubuntu 12上上传文件时会出现这个问题。正在创建目录,但没有上传文件。

我已经读了二十多篇文章,但找不到解决办法。

这里有几行上传程序代码,我不是Ubuntu和Linux的专家,所以这一定是一个错误的配置问题。谁知道呢?

if(!empty($_POST['type_folder'])){          
    $upload_file = FCPATH . '/application/files/'.$_POST['number_identification'].'/'.$_POST['type_folder'].'/COD_'.$_POST['id_agreement'].'/'.sha1($_POST['type_folder']."_".$_POST['id_agreement']."_".$_POST['number_identification']).'.pdf';
    if (file_exists($upload_file)) {
        @unlink($upload_file);
    }
    $file_name = sha1($_POST['type_folder']."_".$_POST['id_agreement']."_".$_POST['number_identification']);
    $final_upload_folder = $upload_sub_sub_folder_by_service;
}                   
if ($status != "error")
{
    $config['upload_path'] = $final_upload_folder;          
    $config['allowed_types'] = 'pdf';
    $config['max_size'] = 1024 * 1024 * 4;
    $config['file_name'] = $file_name;          
    $this->load->library('upload', $config);
    if (!$this->upload->do_upload($file_element_name))
    {
        $status = 'error';
        $msg = $this->upload->display_errors('', '');
    }
    else
    {
        //echo "<pre>"; Print_r($this->upload->data()); echo "</pre>";
        $data = $this->upload->data();
        ...
    }

检查文件夹的权限。如果你用php编程创建你的文件夹,你可以设置你的权限后http://php.net/manual/en/function.chmod.php。

chmod("/path/to/somedir", 0755);