Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8600625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:39:32+00:00 2026-06-12T01:39:32+00:00

$model = new XUploadForm; $model->file = CUploadedFile::getInstance( $model, ‘file’ ); //We check that the

  • 0
            $model = new XUploadForm;
            $model->file = CUploadedFile::getInstance( $model, 'file' );
            //We check that the file was successfully uploaded
            if( $model->file !== null ) {
                //Grab some data
                $model->mime_type = $model->file->getType( );
                $model->size = $model->file->getSize( );
                $model->name = $model->file->getName( );
                $file_extention = $model->file->getExtensionName( );
                //(optional) Generate a random name for our file
                $file_tem_name = md5(Yii::app( )->user->id.microtime( ).$model->name);
                $file_thumb_name = $file_tem_name.'_thumb.'.$file_extention;
                $file_image_name = $file_tem_name.".".$file_extention;
                if( $model->validate( ) ) {
                    //Move our file to our temporary dir
                    $model->file->saveAs( $path.$file_image_name );
                    if(chmod($path.$file_image_name, 0777 )){

     //                 Yii::import("ext.EPhpThumb.EPhpThumb");
                    // $thumb_=new EPhpThumb();
                 //      $thumb_->init();
                    // $thumb_->create($path.$file_image_name)
                    //  ->resize(110,80)
                    //  ->save($path.$file_thumb_name); 


                    }
                    //here you can also generate the image versions you need 
                    //using something like PHPThumb





                    //Now we need to save this path to the user's session
                    if( Yii::app( )->user->hasState( 'images' ) ) {
                        $userImages = Yii::app( )->user->getState( 'images' );
                    } else {
                        $userImages = array();
                    }
                     $userImages[] = array(
                          "filename" => $file_image_name,
                        'size' => $model->size,
                        'mime' => $model->mime_type,
                        "path" => $path.$file_image_name,
                       // "thumb" => $path.$file_thumb_name,
                    );
                    Yii::app( )->user->setState('images', $userImages);      
                    //Now we need to tell our widget that the upload was succesfull
                    //We do so, using the json structure defined in
                    // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup
                    echo json_encode( array( array(
                            "type" => $model->mime_type,
                            "size" => $model->size,
                            "url" => $publicPath.$file_image_name,
                            //"thumbnail_url" => $publicPath.$file_thumb_name,
                            //"thumbnail_url" => $publicPath."thumbs/$filename",
                            "delete_url" => $this->createUrl( "upload", array(
                                "_method" => "delete",
                                "file" => $file_image_name
                            ) ),
                            "delete_type" => "POST"
                        ) ) );

Above code give me correct response,
[{“type”:”image/jpeg”,”size”:2266,”url”:”/uploads/tmp/0b00cbaee07c6410241428c74aae1dca.jpeg”,”delete_url”:”/api/imageUpload/upload?_method=delete&file=0b00cbaee07c6410241428c74aae1dca.jpeg”,”delete_type”:”POST”}]

but if I uncomment the following

         //     Yii::import("ext.EPhpThumb.EPhpThumb");
                // $thumb_=new EPhpThumb();
             //      $thumb_->init();
                // $thumb_->create($path.$file_image_name)
                //  ->resize(110,80)
                //  ->save($path.$file_thumb_name);   

it gave me corrupted response:

Mac OS X 2��ATTR�dA��Y�Ycom.apple.quarantine0001;50655994;Google\x20Chrome.app;2599ECF9-69C5-4386-B3D9-9F5CC7E0EE1D|com.google.ChromeThis resource fork intentionally left blank ��[{“type”:”image/jpeg”,”size”:1941,”url”:”/uploads/tmp/409c5921c6d20944e1a81f32b12fc380.jpeg”,”delete_url”:”/api/imageUpload/upload?_method=delete&file=409c5921c6d20944e1a81f32b12fc380.jpeg”,”delete_type”:”POST”}]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:39:33+00:00Added an answer on June 12, 2026 at 1:39 am

    I’m guessing MacOS has quarantined your download of ext.EPhpTHumb.EPhpThumb or one of its libraries.

    If you know where the plugin is installed, try xattr -d com.apple.quarantine <filename> from a terminal to remove it, or google remove mac os x quarantine status for alternate ways to do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How will I determine if a new model was successfully save in symfony? I
After making some changes in my models (eg. new field in a model and
I have an UIViewController subclass that allows the user to add a new model
I'm trying to do something like the following: @special_attributes = Model.new.methods.select # a special
If I generate new model, view and controller with rails scaffold generator I get
I want to create one new model class, which will be extended in all
I've written a new model for my CodeIgniter framework. I'm trying to load the
Im new to asp.net mvc. I'm trying add new model class but it got
I have Controller: [MySite]\Controllers\DistributionTools\TrackingChannelsController.cs [HttpPost] public void InitTcFirstPageView() { var model = new TcFirstPageModel
Benefit Set: </label><br /> <%: Html.DropDownListFor(model => model.bvODSMapping.Benefit_Set, Model.BenefitSet,new {id=BSet, style = width:230px; })%>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.