[Codeigniter File Upload Class] The filetype you are attempting to upload is not allowed

OH F KIDDIN’ ME!!! After one looo…ooong day, el finale, et voila…. Ich habe est gefunden!

You got the same problem with me? The solution are here (from this guy‘s stack overflow):

****

If you’re using Codeigniter version 2.1.0 there is a BUG in the Upload library. See http://codeigniter.com/forums/viewthread/204725/  for more details.

Basically what I did was modify a few lines of code in the File Upload Class (Location: ./system/libraries/Upload.php)

1) modify Line number 1044

from:

$this->file_type = @mime_content_type($file['tmp_name']);
return;

to this:

$this->file_type = @mime_content_type($file['tmp_name']);
if (strlen($this->file_type) > 0) return;

2) modify line number 1058

from:

@exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code);

to this:

@exec('file --brief --mime-type ' . escapeshellarg($file['tmp_name']), $output, $return_code);

As you can probably see, line 1058 tries to use an array value that does not exist.

Iklan

One Comment Add yours

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s