Yii Framework Forum: How to use external library. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to use external library. Rate Topic: -----

#1 User is offline   Dan Din Dun 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 77
  • Joined: 09-February 10

Posted 07 March 2010 - 08:03 PM

hi,

I was frustation using CUploadedFile so I decide to try external libary and I use from this site http://www.verot.net...oad_samples.htm,

but I get error when using this library.
here is my code:
if($_FILES['filename']){
                        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;
                             $handle->process('thumb');
                        }
                    }


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
Description

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

/mnt/win_d/www/myapp/framework/YiiBase.php(338)

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
Thanks and Kind Regards
------
DanDinDun
0

#2 User is offline   Y!! 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 978
  • Joined: 18-June 09

Posted 07 March 2010 - 08:59 PM

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

Quote

As of PHP 5.3, Fileinfo is shipped with the main distribution and enabled by default. The extension is no longer maintained in PECL.


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

#3 User is offline   bettor 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 744
  • Joined: 02-February 09

Posted 08 March 2010 - 08:30 AM

y r u frustrated with CUploadedFile?
0

#4 User is offline   Dan Din Dun 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 77
  • Joined: 09-February 10

Posted 08 March 2010 - 04:04 PM

View Postbettor, on 08 March 2010 - 08:30 AM, said:

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
Thanks and Kind Regards
------
DanDinDun
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users