[split] Upload library issue with 3.1.5? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: [split] Upload library issue with 3.1.5? (/showthread.php?tid=68343) |
[split] Upload library issue with 3.1.5? - Carlos Villegas - 06-26-2017 Can you please double check Library Upload please ? There is sometimes when the file doesn't exist in the server. This function worked well on 3.0.6: public function upload_documents($id) { $config['upload_path'] = './uploads/pedidos/files/'; $config['allowed_types'] = '*'; $config['overwrite'] = false; $files = $_FILES; $this->load->library('upload', $config); $row['id_pedido'] = $id; $row['fecha'] = date('Y-m-d H:i:s'); $row['estatus'] = 1; if (isset($files['documentos'])) { for ($i = 0; $i < count($files['documentos']['name']); $i++) { if ($files['documentos']['size'][$i] > 0) { $_FILES['documento']['name'] = Str::cleanFilename($files['documentos']['name'][$i]); $_FILES['documento']['type'] = $files['documentos']['type'][$i]; $_FILES['documento']['size'] = $files['documentos']['size'][$i]; $_FILES['documento']['error'] = $files['documentos']['error'][$i]; $_FILES['documento']['tmp_name'] = $files['documentos']['tmp_name'][$i]; if ($this->upload->do_upload('documento')) { $row['nombre'] = Str::minifySpaces($files['documentos']['name'][$i]); $row['ruta'] = 'uploads/pedidos/files/' . $this->upload->data('file_name'); $this->db->insert('documento_pedido', $row); } else { $this->session->set_flashdata('error_header', '<p>Falló la subida de un archivo, por favor intenta de nuevo.</p>'); $this->session->set_flashdata('errors', $this->upload->display_errors()); } } } } } |