Fancyupload and mime types

Hi all,

I’m using FancyUpload to upload an image on a local MAMP installation.

I’m having trouble getting the right mime type using CFileHelper::getMimeType() as illustrated in the example that goes with the extension. Here’s a few lines from that:


 switch(CFileHelper::getMimeType($file->getTempName())){

       case 'application/zip':

           break;

 

       case 'image/jpeg':

           $info = @getimagesize($file->getTempName());

            if ($info) {

                $return['width']  = $info[0];

                $return['height'] = $info[1];

                $return['mime']   = $info['mime'];

            }

           break;



When uploading an image the mime type comes out as application/octet-stream which is not what I expected, was hoping for image/jpeg.

Does anyone have any idea what’s going on here?

Cheers

Flash uploaders always send application/octet-stream in the HTTP mimetype.

You can use fileinfo (yii already supports this but you must have the extension installed) to get the uploaded file mimetype.

Hey,

It is my fault, I should’ve updated the documentation and code for the extension

Try using $file->getName()

Please, see the topic

http://www.yiiframework.com/forum/index.php?/topic/6377-extension-fancyupload/page__hl__fancyupload__fromsearch__1

There are some fixes discussed that could help you for a while

I’ll try to update the extension and docs today.

Regards!!

Hey, guys, I’ve updated the fancyupload extension, please check version 1.3 working samples and instructions file

Regards!!