-
-
Save aleckyann/e879004d751c4bce856e418310326033 to your computer and use it in GitHub Desktop.
upload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* use no form: enctype="multipart/form-data" | |
**/ | |
public function insert_foto($equipamento) | |
{ | |
$config['upload_path'] = FCPATH . 'public/application/equipamentos/fotos'; | |
$config['allowed_types'] = 'jpg|png|jpeg|gif|tif'; | |
$config['max_size'] = 1024 * 5; | |
$config['overwrite'] = TRUE; | |
$config['file_name'] = $equipamento['equipamento_id']; | |
$this->upload->initialize($config); | |
if($this->upload->do_upload('equipamento_foto')){ | |
$caminho = base_url() . 'public/application/equipamentos/fotos/' . $this->upload->data()['file_name']; | |
$this->db->update('equipamentos', array('equipamento_foto' => $caminho), 'equipamento_id = ' . $equipamento['equipamento_id']); | |
} else { | |
pre($this->upload->display_errors());//error | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment