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

Also I forgot to mention I'm using CI 3.0.6, and PHP 5.5.26
Reply
#3

i know this problem
Reply
#4

(07-05-2016, 05:24 PM)phambinh217 Wrote: i know this problem

Can you help me with that please?
Reply
#5

UPDATE:

I tried the * symbol as allowed type, and accepted my file. But of course, is not what I'm looking for.
Reply
#6

Is GD PHP-extension installed in your server? Does the function getimagesize() work there?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB