0

First of all, there are already a lot of (solved) questions regarding this topic. And I tried all possible solutions. But to no avail.

  • The problem occurs in both CI versions 2.1.4 and 2.2.1.
  • I also tried using different filetypes, such as png,gif and txt.
  • I've done no mime-type alterations, eg. by using AddType in the .htaccess file
  • I've used a simple html form, and a Postman for debugging
  • I've tried it with both PHP versions 5.5 and 5.6 (fileinfo module enabled)
  • The mime types do exist in the mimes.php file
  • The tmp folder is writable

I'm out of options...
Does anybody know what the issue might be?

Thanks in advance!


configuration

$this->uploadconfig =  array(
    'upload_path'     => "./tmp/",
    'allowed_types'   => "png|gif|txt",
    'overwrite'       => TRUE,
    'max_size'        => "25000KB",
    'max_height'      => "5000",
    'max_width'       => "5000"
);
$this->load->library('upload', $this->uploadconfig);

error

The filetype you are attempting to upload is not allowed.

output

[file_name] => test.png
[file_type] => image/png
[file_path] => /CORRECT_SERVER_PATH/tmp/
[full_path] => /CORRECT_SERVER_PATH/tmp/test.png
[raw_name] => test
[orig_name] => 
[client_name] => test.png
[file_ext] => .png
[file_size] => 851
[is_image] => 1
[image_width] => 
[image_height] => 
[image_type] => 
[image_size_str] => 
halfer
  • 19,824
  • 17
  • 99
  • 186
Diederik
  • 377
  • 3
  • 13

1 Answers1

0

I found the solution:

Codeigniter 2.1.4 has a bug as described here.
So I've update CI to version 2.2.1, folowing the update instrucions here and here.

After checking the mimes.php file for a second time, I noticed a difference between my original file, and the one included in the newer version. I replaced the old one with the newer one, and the problem was solved.

Not documented in the upgrade instructions, is the fact that there is a difference between both files. The older (CI 2.1.4) of the file returns an array. The newer one (CI 2.2.1) does not return an array, but sets an array with the variable name $mimes.

Community
  • 1
  • 1
Diederik
  • 377
  • 3
  • 13