How to use external library.


I was frustation using CUploadedFile so I decide to try external libary and I use from this site,

but I get error when using this library.

here is my code:


                        if(move_uploaded_file($_FILES['filename']['tmp_name'], 'images/blue.png')){

                             require_once(Yii::app()->getExtensionPath() . DIRECTORY_SEPARATOR . 'upload/upload.php');

                             $handle = new Upload('images/blue.png');

                             $handle->image_resize          = true;

                             $handle->image_ratio_y         = true;

                             $handle->image_x               = 400;

                             $handle->image_y               = 400;




the process above that I want is, after filename (image) is uploaded, it will be creating thumbnail too and will be stored in "images/thumb" directory.

the error when I test this code is:

PHP Error


include(finfo.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

Source File


00326:      * @param string class name

00327:      * @return boolean whether the class has been loaded successfully

00328:      */

00329:     public static function autoload($className)

00330:     {

00331:         // use include so that the error PHP file may appear

00332:         if(isset(self::$_coreClasses[$className]))

00333:             include(YII_PATH.self::$_coreClasses[$className]);

00334:         else if(isset(self::$_classes[$className]))

00335:             include(self::$_classes[$className]);

00336:         else

00337:         {

00338: include($className.'.php');

00339:             return class_exists($className,false) || interface_exists($className,false);

00340:         }

00341:         return true;

00342:     }

thanks for attention

finfo is obviously a php extension, see here. Someone says there:

So you must either install the fileinfo extension or upgrade to php 5.3.

y r u frustrated with CUploadedFile?

@Y!! thank for your reply and appreciate

@bettor, yes I frustrated about CUploadedFile, I dont know why the error happened. whereas I’m sure I was correct in coding. and ever once time, when I using Linux, I successfull uploading file. but when I change to windows the uploading is failed. and have searching many times on google “how to fix CUploadedFile” and I found there are same problem with me but still don’t any way to fix. so I frustated because I must finishing this job quickly :-(.

but I very glad with Yii Framework. I love Yii Framework so much…

thanks All Yii members and Mr Bettor