Welcome Guest, Not a member yet? Register   Sign In
Upload library not validating properly my files
#1

Hello! I'm meta and I'm from Paraguay. This ain't my first post in the Codeigniter community, as I was a fellow user in the version 2, but at my company we fell out of love with CI until this new version, when boss demanded us to use it again. Don't know what happened to the old forum and old posts, but I registered again to be part.

AND... also to request your help. 

I'm using the upload library to set background images in a project. The thing is that the validator is throwing me file types error, when I specifically set up them properly.

Here is a peek:

Code:
if ( $_FILES ) // The files uploading
{
    $this->load->library( 'upload' );

    $background['upload_path'] = './uploads/images/';
    $background['allowed_types'] = "gif|jpg|png";
    $background['overwrite'] = TRUE;
    $background['file_name'] = 'background';

    if ( $_FILES['background']['size'] > 0 )
    {
        $this->upload->initialize( $background );

        if ( ! $this->upload->do_upload( 'background' ) )
        {
            // error message with $this->upload->display_errors()
        }
        else
        {
            // success message
        }
    }
}

I don't know why I'm getting the following:

The filetype you are attempting to upload is not allowed.

Tried with a lot of images, but still the same issue.

Thanks in advance community. I hope I can contribute with tips and tricks soon. Big Grin
Reply


Messages In This Thread
Upload library not validating properly my files - by meta - 07-05-2016, 03:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB