• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Upload library issue with 3.1.5?

#1
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.