/** * Método que exclui anexos * @param int $pk_anexo O código do anexo */ public function excluir_anexo() { if ($_SERVER['REQUEST_METHOD'] == "POST") { try { View::validarHashIdLink($this->input->post('idData')); $sqlLivro = new SqlLivro(); $sqlLivro->excluir_anexo($this->input->post('idData')); if ($this->input->post('idData2') != '') { unlink(str_replace('./', '', $this->input->post('idData2'))); } echo json_encode(array('msg' => '<p class="alert ok">Registro excluído com sucesso!</p>')); } catch (Exception $e) { echo json_encode(array('erro' => '<p class="alert erro">Erro ao excluir a registro!</p>')); } } return false; }