How do I delete a file, Below the output of the code.. but this code is not working to del the file from the directory....
in controller
public function delete_by_id()
{
$id = $this->uri->segment(3);
$schemeid = $this->uri->segment(4);
$link = $this->uri->segment(5);
$tablename = $this->uri->segment(6);
//unlink code ------------------------------------------>
$del_image = $this->C_model->getrecordwhere($tablename, array('id' => $id));
unlink('upload_attachments/'.$del_image->attched_files);
echo '<pre>';print_r($del_image);die;
// if($tablename== 'progress')
// {
$where = array('id'=>$id);
//$where = array('id'=>$id);
//$where = array('id'=>$id);
//$where = array('id'=>$id);
$this->C_model->deleteid($tablename,$where);
redirect('C2C_contr/'.$link.'/'.$schemeid);
}
output
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: controllers/C2C_contr.php
Line Number: 264
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: controllers/C2C_contr.php
Line Number: 267
A PHP Error was encountered
Severity: Warning
Message: unlink(upload_attachments/): Permission denied
Filename: controllers/C2C_contr.php
Line Number: 267
Array ( [0] => stdClass Object ( [id] => 111 [attched_files] => Untitled4.png [attched_remarks] => ) )