Skip to content

Commit

Permalink
improve-file-delete
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlosb committed Apr 22, 2024
1 parent daca848 commit 6685a82
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions application/controllers/Inspection.php
Original file line number Diff line number Diff line change
Expand Up @@ -972,13 +972,18 @@ public function dynimg($id) {
public function removeimg() {
$imgid = $this->input->post('id');
$filename = $this->itindata_model->getsingleimg($imgid);
if (file_exists('upload/'.$filename)) {
$delete=unlink('upload/'.$filename);
if($delete){
$this->itindata_model->delsingleimg($imgid);
$status = "ok";
}else{
$status = "nok";
} } else {
$this->itindata_model->delsingleimg($imgid);
$status = "ok";
}

$this->output->set_header("Cache-Control: no-cache, must-revalidate");
$this->output->set_header("Expires: Mon, 4 Apr 1994 04:44:44 GMT");
$this->output->set_header("Content-type: application/json");
Expand Down

0 comments on commit 6685a82

Please sign in to comment.