Welcome Guest, Not a member yet? Register   Sign In
[split] Upload library issue with 3.1.5?
#1

(This post was last modified: 06-26-2017, 12:14 PM by ciadmin.)

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());
                    }
                }
            }
        }
    }
Reply




Theme © iAndrew 2016 - Forum software by © MyBB