3

I'm new to the CodeIgniter 3 framework so i'm a bit in the deep with this bugs. Basically, when i try to upload an image it throws me the HTTP ERROR 500 and no errors in the error log on the server.

Here's the controller's function:

if ($_POST)
{
    $config['upload_path'] = './uploads/';
    $config['allowed_types'] = 'gif|jpg|jpeg|png';
    $config['max_size'] = '1024';
    $config['max_width'] = '1920';
    $config['max_height'] = '1280';
    $this->load->library('upload', $config);

    foreach ($_FILES as $fieldname => $fileObject)
    {
        if (!empty($fileObject['name']))
        {
            $this->upload->initialize($config);
            if (!$this->upload->do_upload($fieldname))
            {
                var_dump($this->upload->display_errors());
            }
            else
            {
                 // SUCCESS
            }
        }
    }
}

i've checked the $config['upload_path'] with is_dir, is_writable and such. It's chmod to 777. The $fieldname/$fileObject have correct values. There is no .htaccess added and i'm working in the subdomain root

Any suggestions would be greatly appreciated as i'm out of ideas :)

Peter Theill
  • 3,117
  • 2
  • 27
  • 29
STL
  • 65
  • 2
  • 8
  • @noushid p, if you'll notice...he said he was getting an error message. – cfnerd Oct 31 '16 at 14:52
  • Whenever there is a 500 error, there should be a server log with the exact error message *somewhere*. Are you sure you are looking in the right location? – Pekka Nov 05 '16 at 15:09
  • I have the exact same problem on localhost (windows 10). Anyone found a solution please? – Azmeer Nov 05 '16 at 15:14
  • @Azmeer have you looked in your error log? Depending on what server you are using, it will be in a different path. For XAMPP, the path is http://stackoverflow.com/questions/3719549/where-does-phps-error-log-reside-in-xampp – Pekka Nov 05 '16 at 15:56

3 Answers3

4

this may be php.ini file problem

Open your php.ini file

search for extension=php_fileinfo.dll

if you are using xampp it may be commented by default

change

;extension=php_fileinfo.dll

to

extension=php_fileinfo.dll

and restart your xampp...

this was solve my problem

BIBIN JOHN
  • 354
  • 7
  • 13
3

Enable extension=php_fileinfo.dll in php.ini

Arzon Barua
  • 494
  • 7
  • 11
2

@STL do you Use XAMPP and Codeigniter 3.1.2 ? i experience this too. i think it's a bug in CodeIgniter 3.1.2 as fileinfo.dll is not loaded by default in XAMPP or in CentOS. maybe you should check the fileinfo extension in your server and load it or just downgrade the Codeigniter system to 3.1.0.

source : Github

suwidadi
  • 34
  • 5