I am trying to upload files to my server with codeigniter 3, the program uploads the files without accent like tilde or Latin characters like Ñ, but when uploading a file with an accent like tilde or Ñ the name and shape me problem when downloading, because when I save it, it is named after me Chapter_11 the name would be Chapter_11, and when trying to download it, it does not find the file and it sends it to me with read error, it tells me if a pdf file can not be opened, in case of a document office can not read or open the file because it is damaged.
The data sent by ajax and e checked that sent correctly with accents and everything.
Here is my code to upload a file to the server:
public function document()
{
$config['allowed_types'] = 'docx|xlsx|pdf';
$config['upload_path'] = './assets/archivos/doc/';
$config['remove_spaces'] = TRUE;
$config['max_size'] = '20048';
$this->load->library('upload', $config);
if(!$this->upload->do_upload('file')){
$error = $this->upload->display_errors();
$result = array('error' => true, 'mens' => $error, 'estado' => 3);
echo json_encode($result);
}else{
$data = array(
'nom_doc' => $this->upload->data('file_name'),
'doc_size' => $this->upload->data('file_size'),
'type_doc' => $this->upload->data('file_type'),
'ruta_doc' => $this->upload->data('full_path'),
'id_conf_sist' => 1
);
$res = $this->Config_model->insertDocument($data);
if($res){
$result = array('error' => false, 'mens' => 'El archivo '.$this->upload->data('raw_name').', a sido guardado correctamente.', 'estado' => 1);
echo json_encode($result);
}
}
}
Someone could help me to solve this problem.