2015-07-13 69 views
1

我上傳我的圖像使用codeigniter,上傳的圖像不顯示在我的網站,然後我去了filezilla和搜索有關該文件,文件夾權限是755,但文件權限爲600,如果我將文件權限更改爲644,則圖像顯示正常,但對於所有上傳圖像,我都無法這樣做。那麼,有沒有辦法解決它?Codeigniter:上傳的圖片的權限是600的網絡服務器,圖像不顯示在網站

  $config['upload_path'] = './assets/images/'; 
      $config['allowed_types'] = 'gif|jpg|png'; 
      $config['max_size'] = '100'; 
      $config['max_width'] = '600'; 
      $config['max_height'] = '600'; 
      $config['file_name'] = $id; 

      $this->load->library('upload'); 
      $this->upload->initialize($config); 

      if(!$this->upload->do_upload()) 
      { 
       $error = array('error' => $this->upload->display_errors());     
       redirect('', $error); 
      } 
      else 
      { 
       chmod($config['upload_path'], 0755); 
       redirect(''); 
      } 

回答

0

這try代碼 變化permision文件夾而不是文件

$config['upload_path'] = chmod('./assets/images/', 0755); 
     $config['allowed_types'] = 'gif|jpg|png'; 
     $config['max_size'] = '100'; 
     $config['max_width'] = '600'; 
     $config['max_height'] = '600'; 
     $config['file_name'] = $id; 

     $this->load->library('upload'); 
     $this->upload->initialize($config); 

     if(!$this->upload->do_upload()) 
     { 
      $error = array('error' => $this->upload->display_errors());     
      redirect('', $error); 
     } 
     else 
     { 
      $config['upload_path']; 
      redirect(''); 
     } 
+0

它是不會上傳我的形象,而不是存儲在服務器中。 – 151291

0
$config['upload_path'] = './assets/images/'; 
    $config['allowed_types'] = 'gif|jpg|png'; 
    $config['max_size'] = '100'; 
    $config['max_width'] = '600'; 
    $config['max_height'] = '600'; 
    $config['file_name'] = $id; 
    $uploadata = array('upload_data' => $this->upload->data()); 
    $perfile = $uploadata ['upload_data']['full_path']; 
    chmod($perfile ,0777) 
相關問題