hi this is my controller :
It work but the file made with this command have problem , if i set txt i have the document isn't a valid UTF-8 .
If i set zip , the archive cannot open ....
How can i solve ?
Code:
public function backup_database(){
$data=[];
$oggi=date ("d-m-Y");
// Load the DB utility class
$this->load->dbutil();
// Backup your entire database and assign it to a variable
$backup = $this->dbutil->backup();
$this->load->library('zip');
// Load the file helper and write the file to your server
$this->load->helper('file');
if(write_file("backup_db/backup".$oggi.".txt", $backup)){
$this->load->view('templates/header_admin');
$this->load->view('templates/menu_admin');
$this->load->view('admin/db_backup_ok', $data);
$this->load->view('templates/footer_admin');
}else{
$this->load->view('templates/header_admin');
$this->load->view('templates/menu_admin');
$this->load->view('admin/db_backup_error', $data);
$this->load->view('templates/footer_admin');
}
}It work but the file made with this command have problem , if i set txt i have the document isn't a valid UTF-8 .
If i set zip , the archive cannot open ....
How can i solve ?