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 7602399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:24:07+00:00 2026-05-30T23:24:07+00:00

I am currently trying to use Miles J plugin located here http://milesj.me/code/cakephp/uploader Although I

  • 0

I am currently trying to use Miles J plugin located here http://milesj.me/code/cakephp/uploader Although I have made great progress learning CakePhp, I am currently having a problem using the plugin and I would appreciate any help provided.

I have followed all the necessary steps to use the plugin. It has been downloaded put on Plugin folder, I bootstrapped with CakePlugin::loadAll().

So far so good.

Next I have proceed to set up the table as indicated by the plugin developer.

Ok, now back to my own code. I have the following set up:

images_controller.php , image.php and their views.

My goal now is to use the plugin inside those files as such:

App::import('Vendor', 'Uploader.Uploader');

Class ImagesController extends AppController {

     var $components = array('Auth');
     var $helpers = array('Design');
     var $uses = array('Image', 'Uploader.Upload');

     function manage(){
         //here I show a simple upload form that uses the action saveimage 
     }

     function saveimage(){

          $this->Uploader = new Uploader();
          if(!empty($this->data)){
               $this->Upload->save($this->data);
          }


     }



}

Now, my model is set as follows

Class Image extends AppModel {

       public $useTable = 'uploads';
       public $actsAs = array(
        'Uploader.FileValidation' => array(
            'file' => array(
                'extension' => array(
                    'value' => array('gif', 'jpg', 'jpeg'),
                    'error' => 'Only gif, jpg and jpeg images are allowed!'
                ),
                'minWidth' => 500,
                'minHeight' => 500,
                'required' => true
            ),
            'import' => array(
                'required' => false
            )
        ),
        'Uploader.Attachment' => array(
            'file' => array(
                'name' => 'uploaderFilename',
                'uploadDir' => '/files/uploads/',
                'dbColumn' => 'path',
                'maxNameLength' => 30,
                'overwrite' => true,
                'stopSave' => false,
                'transforms' => array(
                    // Save additional images in the databases after transforming
                    array(
                        'method' => 'resize',
                        'width' => 100,
                        'height' => 100,
                        'dbColumn' => 'path_alt'
                    )
                ),
                'metaColumns' => array(
                    'size' => 'filesize',   // The size value will be saved to the filesize column
                    'type' => 'type'        // And the same for the mimetype
                )
            ),
            'import' => array(
                'uploadDir' => '/files/uploads/',
                'name' => 'uploaderFilename',
                'dbColumn' => 'path',
                'overwrite' => true,
                'stopSave' => false,
                'transforms' => array(
                    array(
                        'method' => 'scale',
                        'percent' => .5,
                        'dbColumn' => 'path' // Overwrite the original image
                    )
                )
            )
        )
    );


}

}

On my model for testing purposes I have not changed anything but just copied and pasted the very same array as shown in the the Test/Model folder inside the plugin, which is meant to show the functionality of the plugin.

The following confusion, errors or lack of understanding is taking place:

My file is not being uploaded to the webroot/files/uploads folder
My data is being inserted in the database, but not in a complete manner by leaving empty as shown:

id | caption | path | path_alt | created  |
4  |         |      |          |2012:02:..|

Above, I expect the path to be saved, but it doesn’t.

I have to admit my confusion comes mainly from my inexperience using plugins, so I am aware I might be doing something wrong regarding my models or my configuration.

Any prompt help would be appreciated greatly as I have tried to work this out on my own without any success.

  • 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-05-30T23:24:09+00:00Added an answer on May 30, 2026 at 11:24 pm

    A few things:

    1 – In your controller you do not need to import the Uploader class. You also don’t need to use the Uploader.Upload model (it’s merely an example test case). All you need to do in the controller is call $this->Image->save() which will upload the file and save the path as a row into the database (if you defined the Attachment in Image).

    2 – In your view, create the file input. Pay attention to the input name.

    echo $this->Form->input('FILE_INPUT_NAME', array('type' => 'file'));
    

    3 – In your Image model, setup the AttachmentBehavior and its options for that specific input field:

    'Uploader.Attachment' => array(
        'FILE_INPUT_NAME' => array(
            'uploadDir' => '/files/uploads/',
            'dbColumn' => 'path'
        ),
        'ANOTHER_INPUT' => array()
    );
    

    Be sure that the column “path” exists in your images table. And thats it.

    For more information on what each option does, check out the following: http://milesj.me/code/cakephp/uploader#uploading-files-through-the-model

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

Sidebar

Related Questions

I am currently trying to use this gem http://github.com/pengwynn/linkedin . Everything works fine (i.e.
I'm currently trying to use the YouTube API as part of a jQuery plugin
I am currently trying to use pHash.dll on http://phash.org Unfortunately it was written in
I am currently trying to use Eclipse to develop some code that I've been
Im currently trying to use a jQuery plugin: jQuery Autocomplete Tokenizer Now after posting
I am currently trying to use NAnt and CruiseControl.NET to manage various aspects of
I am currently trying to use AJAX in my application via jRails. I am
I'm currently trying to use the latest stable fmod ex in my project. I
I'm having trouble editing an XML file. I'm currently trying to use Nokogiri ,
currently i'm trying to use imagick to generate some images without saving them on

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.