2014-05-04 46 views
0

如何從刪除按鈕中從codeigniter中上傳的文件夾中刪除圖像文件? 任何人都可以引導我? 這裏是我的控制器,上傳圖片文件如何刪除圖片文件?

private function upload() { 
    $config['upload_path'] = 'assets/uploads/orginal/'; 
    $config['allowed_types'] = 'gif|jpg|png|jpeg|x-png'; 
    $config['max_size'] = '500'; 
    $config['max_width'] = '1600'; 
    $config['max_height'] = '1200'; 
    $config['remove_spaces'] = TRUE; 
    $this->load->library('upload', $config); 
    if ($this->upload->do_upload()) { 
     $img = $this->upload->data(); 
     // create thumbnail 
     $new_image = 'assets/uploads/thumbs/' . $img['file_name']; 

     $c_img_lib = array(
      'image_library' => 'gd2', 
      'source_image' => $img['full_path'], 
      'maintain_ratio' => TRUE, 
      'width' => 100, 
      'height' => 100, 
      'new_image' => $new_image 
     ); 

     $this->load->library('image_lib', $c_img_lib); 
     $this->image_lib->resize(); 
    } else { 
     $this->data['error'] = $this->upload->display_errors(); 
    } 
} 

回答