CodeIgniter: "The filetype you are attempting to upload is not allowed."

Solution 1:

You are using Firefox, aren't you?

You could try looking at system/libraries/Upload.php line 199:

$this->_file_mime_type($_FILES[$field]);

Change that line to:

$this->_file_mime_type($_FILES[$field]); var_dump($this->file_type); die();

Then do upload your .wmv file. It would show something like application/octet-stream or whatever. Add that to your mimes.php. Hope this help =)

Similar answer here

Some links:

  • CodeIgniter forum's thread
  • Mimetype corruption in Firefox
  • Getting around IE’s MIME type mangling

Solution 2:

$config["allowed_types"] ="*";

Solution 3:

  1. Upload your .wmv file to the server using FTP/SFTP/scp/etc where you run the CodeIgniter application
  2. On the server where you have uploaded the .wmv file, execute the following PHP code

    <?php
    $file_path = 'CHANGE_THIS_TO_ABSOLUTE_FILE_PATH_THAT_YOU_HAVE_UPLOADED.wmv';
    $finfo = finfo_open(FILEINFO_MIME);
    $mime = finfo_file($finfo, $file_path);
    var_dump($mime);
    ?>
    
  3. Save the code as mime.php

  4. Run in the terminal - $ php mime.php
  5. If it dumps any other value than you already have for wmv, append that value into wmv mime types.

Also check PHP_VERSION in other development machines. finfo_open is introduced in PHP 5.3. The development machine where upload is working may have an older version of PHP or it may have right mime type for the wmv.