public function test(){ //ROOT_PATH . 'public' . DS . 'uploads' $filename = ROOT_PATH . 'public' . DS . 'uploads/2.jpg'; if(file_exists($filename)){ unlink($filename); }else{ return 2; } }