我有一个图片上传表单,我已成功上传图片并尝试删除图片,但它只删除数据库,我不知道如何删除路径。(如何使用取消链接) 这是我的代码
function deleteconf($data){
$update_id=$this->uri->segment(3);
$query= $this->_delete($update_id);
redirect('banner/manage');
}
function upload(){
if($this->input->post('upload')){
$data['banner_name'] =$this->input->post('banner_name',TRUE);
$data['banner_img1'] =$_FILES['files']['name'][0];
$config=array(
'allowed_types' => 'jpg|jpeg|png|gif',
'upload_path' => $this->gallery_path,
'max_size' => '2000'
);
$this->load->library('upload');
$this->upload->initialize($config);
if($this->upload->do_upload()){
$data['images']=$this->save_gallery($data);
}else{
echo $this->upload->display_errors();
}
$image_data=$this->upload->data();
}
$data['images']=$this->get_images();
$data['view_file']='banner_form';
$this->load->module('template');
$this->template->one_col_temp($data);
}
答案 0 :(得分:1)
您可以使用取消关联并将其传递给您的图片路径 例如
@unlink('MY_UPLOAD/file1.jpg');
答案 1 :(得分:0)
试试这个
@unlink(PATH_DIR.'uploads/xyz.jpg');