• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
upload library processing with wrong mime type

#1
First, thanks for providing such a wonderful framework. I'm new here, don't know about many rules of the forum so sorry in advance.


I found the custom mime is not working and also, the _file_mime_type() not working correctly.

Basically if i upload any apk file then the mime should be "application/vnd.android.package-archive" but program returning only "application/zip". Maybe i'm wrong(i know that this wonderful framework is developed by the best php experts around the globe) but please help me to understand how i can deal with it.

I started debugging and landed on this function. Here is the code:

      if (function_exists('finfo_file'))
      { 
         $finfo = @finfo_open(FILEINFO_MIME);
         if (is_resource($finfo)){
            $mime = @finfo_file($finfo, $file['tmp_name']);
            finfo_close($finfo);

            if (is_string($mime) && preg_match($regexp, $mime, $matches))
            {
               log_message('error', json_encode([$mime, $matches,$matches[1]]));
               $this->file_type = $matches[1];
               return;
            }
         }
      }
Reply

#2
You would need to add that mime type to CodeIgniters mimes

./application/config/mimes.php

Just look at the others and then add your type like them.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(05-02-2019, 04:35 AM)InsiteFX Wrote: You would need to add that mime type to CodeIgniters mimes

./application/config/mimes.php

Just look at the others and then add your type like them.

wrong. finfo is the problem https://bugs.php.net/bug.php?id=74573
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.