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

  • Home
  • SEARCH
  • 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 8721699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:15:46+00:00 2026-06-13T07:15:46+00:00

I am using this plugin: MileJ CakePHP Uploader which works really well however I

  • 0

I am using this plugin: MileJ CakePHP Uploader which works really well however I can only get it to work through the controller, not as a behavior in the model which I need to get working so I can use the feature to pass the file into Amazon s3.

My code is as follows, can anyone see where I am going wrong? At the moment the database record is generated but only with the other fields I have on the form (caption, card_id, user_id) nothing to do with the file comes though. the file is not uploaded either.

Model: DataFile.php

public $actsAs = array(
    'Uploader.FileValidation' => array(
        'file1' => array(
            'required' => true
        ),
        'file2' => array(
            'required' => false
        ),
        'file3' => array(
            'required' => true
        )
    ),
    'Uploader.Attachment' => array(
        'file' => array(
            'name' => '',
            'uploadDir' => 'files/data_files/',
            'dbColumn' => 'path',
            'maxNameLength' => 30,
            'overwrite' => true,
            'stopSave' => false,
            's3'        => array(
                                'accessKey' => 'MYACCESSKEY',
                                'secretKey' => 'MYSECRETKEY',
                                'ssl' => true,
                                'bucket' => 'testfilespath',
                                'path' => '/'
                            ),                  // Array of Amazon S3 settings              
            'metaColumns' => array(
                    'ext' => 'extension',
                    'size' => 'bytesize',
                    'group' => 'group',
                    'width' => 'width',
                    'height' => 'height',
                    'filesize' => 'filesize'
            )
        )
    )
);  

Controller: DataFileController.php

// ADD BY BEHAVIOUR NEW FILE(S) - NOT WORKING
// ---------------------------------------------------------->
function add_behavior() 
{
    if (!empty($this->request->data)) 
    {

        if ($this->DataFile->save($this->request->data)) 
        {
            debug($this->request->data);

            $this->Session->setFlash(__('The File has been uploaded');
            $this->redirect(array('action' => 'index'));
        } 
        else 
        {
            $this->Session->setFlash(__('The DataFile could not be saved. Please, try again.'));
        }
    }
}

View: add_behavior.ctp

<?php echo $this->Form->create('DataFile', array('type' => 'file')); ?>
    <?php
    echo $this->Form->input('user_id', array('value' => $this->Session->read("Auth.User.id"),  'type' => 'text'));
    echo $this->Form->input('card_id', array('value' => '1',  'type' => 'text'));
    echo $this->Form->input('caption', array('label' => 'File Title'));
    echo $this->Form->input('file1', array('type' => 'file', 'label' => 'File'));
    ?>
    <?php echo $this->Form->end(__('Upload'));?>
  • 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-13T07:15:47+00:00Added an answer on June 13, 2026 at 7:15 am
    Uploader.Attachment => array(
            'file1' => array(...),
            'file2' => array(...),
            'file3' => array(...),
    );
    

    When using the behaviour you must specify the name of your file field within the Uploader.Attachment array.

    Your form field is called file1, the behaviour is currently looking for file.

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

Sidebar

Related Questions

I am using this plugin. http://jquery.malsup.com/block/#overview However I would like this blockUI to only
I am using this plugin to establish a cookie Everything works well but in
I am using this autocomplete Plugin which works great but the problem is $('#request_song').autocomplete({
I am using this plugin in Wordpress http://www.iwebix.de/front-slider-wordpress-plugin-demo/ As you can see in the
I am using this plugin and in some pages I get an Uncaught TypeError:
So i'm using this plugin https://github.com/podio/jquery-mentions-input for my comment system, everything works fine but
I am using this plugin to create charts: http://www.filamentgroup.com/lab/update_to_jquery_visualize_accessible_charts_with_html5_from_designing_with/ The code works below if
I'm using this plugin: http://loopj.com/jquery-tokeninput/ to do a suggestion field, where the user can
I am using this time-picker plugin. labs.perifer.se/timedatepicker/jquery.timePicker.js It works fine with jquery 1.2. see
Im using this plugin: http://sorgalla.com/projects/jcarousel/ I want there do be a counter that can

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.