Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Problems with Upload library
#1
Bug 
(This post was last modified: 05-27-2018, 05:32 PM by chapacua.)

Hello! 

Before anything i want to say that i'm not a English speaker so i want to apologize for any mistake i would do

So i'm trying to upload a file from form, using CI upload library, but it isn't work and give to me a error message.

This is the function that instance the library 

Code:
    public function createIngrediente()
    {
    
        $data = array
        (
            'Ing_Nombre' => $this->security->xss_clean($this->input->post('Ing_Nombre')),
            'Cat_Id' => $this->security->xss_clean($this->input->post('Cat_Id')),
            'Ing_Descripcion' => $this->security->xss_clean($this->input->post('Ing_Descripcion'))
        );

        $config['upload_path']          = './views/public/img/ingredientes/';
        $config['file_name']              = 'ingrediente';
        $config['allowed_types']        = 'gif|jpg|png';
        $config['max_size']             = 100000;
        $config['max_width']            = 1024;
        $config['max_height']           = 768;

        $this->load->library('Upload', $config);

        if ( ! $this->upload->do_upload('userfile'))
        {
                $error = array('error' => $this->upload->display_errors());

                $this->load->view('upload_form', $error);
        }
        else
        {
            var_dump($this->upload->data());
        }            
        //$this->Ingredientes_model->createIngrediente($data);
        echo 1;
        return true;
    }

And this is the error that i get when i run it

Code:
An Error Was Encountered

Unable to load the requested file: upload_form.php

I validate in System/Library folder and there is the Upload.php file i try too loading library from autoload and from Constructor method, but error persists
The current version i'm using is CI 3.1.8

Thanks a lot!
Reply
#2

(This post was last modified: 05-25-2018, 09:31 AM by Paradinight.)

(05-25-2018, 08:51 AM)chapacua Wrote: Hello! 

Before anything i want to say that i'm not a English speaker so i want to apologize for any mistake i would do

So i'm trying to upload a file from form, using CI upload library, but it isn't work and give to me a error message.

This is the function that instance the library 

Code:
public function createIngrediente()
{

$data = array
(
'Ing_Nombre' => $this->security->xss_clean($this->input->post('Ing_Nombre')),
'Cat_Id' => $this->security->xss_clean($this->input->post('Cat_Id')),
'Ing_Descripcion' => $this->security->xss_clean($this->input->post('Ing_Descripcion'))
);

$config['upload_path']          = './views/public/img/ingredientes/';
$config['file_name']           = 'ingrediente';
$config['allowed_types']        = 'gif|jpg|png';
$config['max_size']             = 100000;
$config['max_width']            = 1024;
$config['max_height']           = 768;

$this->load->library('Upload', $config);

if ( ! $this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());

$this->load->view('upload_form', $error);
}
else
{
var_dump($this->upload->data());
}
//$this->Ingredientes_model->createIngrediente($data);
echo 1;
return true;
}

And this is the error that i get when i run it

Code:
An Error Was Encountered

Unable to load the requested file: upload_form.php

I validate in System/Library folder and there is the Upload.php file i try too loading library from autoload and from Constructor method, but error persists
The current version i'm using is CI 3.1.8

Thanks a lot!

is the upload_form.php file in the application/view folder?
Reply
#3

(05-25-2018, 09:31 AM)Paradinight Wrote:
(05-25-2018, 08:51 AM)chapacua Wrote: Hello! 

Before anything i want to say that i'm not a English speaker so i want to apologize for any mistake i would do

So i'm trying to upload a file from form, using CI upload library, but it isn't work and give to me a error message.

This is the function that instance the library 

Code:
public function createIngrediente()
{

$data = array
(
'Ing_Nombre' => $this->security->xss_clean($this->input->post('Ing_Nombre')),
'Cat_Id' => $this->security->xss_clean($this->input->post('Cat_Id')),
'Ing_Descripcion' => $this->security->xss_clean($this->input->post('Ing_Descripcion'))
);

$config['upload_path']          = './views/public/img/ingredientes/';
$config['file_name']           = 'ingrediente';
$config['allowed_types']        = 'gif|jpg|png';
$config['max_size']             = 100000;
$config['max_width']            = 1024;
$config['max_height']           = 768;

$this->load->library('Upload', $config);

if ( ! $this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());

$this->load->view('upload_form', $error);
}
else
{
var_dump($this->upload->data());
}
//$this->Ingredientes_model->createIngrediente($data);
echo 1;
return true;
}

And this is the error that i get when i run it

Code:
An Error Was Encountered

Unable to load the requested file: upload_form.php

I validate in System/Library folder and there is the Upload.php file i try too loading library from autoload and from Constructor method, but error persists
The current version i'm using is CI 3.1.8

Thanks a lot!

is the upload_form.php file in the application/view folder?

I feel so dump right now, i didn't have that file, thank you so much!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB