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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:22:27+00:00 2026-06-09T22:22:27+00:00

I want to use the Plugin with CakePHP 2.1 as behaviour through $actAs =

  • 0

I want to use the Plugin with CakePHP 2.1 as behaviour through $actAs = ‘Uploader.Attachment’. While this works fine for static Uploads, I dont know how to use it for ajaxUploads.

The simple Question:
Is there anyway to make an ajax-Upload happen through the actAs-Behaviour?

The explanation (if needed):
The attachment Behaviour doesn’t seem to have any defaults nor any other code regarding ajax (especially not the ajaxField in the following code). Though it works if I include the Plugin via

public function beforeFilter() {
    $this->Uploader = new Uploader(array(
        'ajaxField' => 'qqfile'
    ));
}

So I can use something like:

$data = $this->Uploader->upload($this->Uploader->ajaxField, array('overwrite' => true));

But not with:

$this->request->data;

This is not quite what I was seaching for, as I
1. Still need the actAs-Behaviour for other actions.
2. Have two different inclusions of the plugin, which I have to check that they do the same.
3. Can’t automatically create thumbs and attach them to the same entry of the model.

  • 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-09T22:22:29+00:00Added an answer on June 9, 2026 at 10:22 pm

    This is what I did now for my specific case. Maybe it helps someone. Not beautiful but it works:

    public function beforeFilter() {
        $this->Uploader = new Uploader(array(
            'ajaxField' => 'qqfile'
        ));
    }
    
    public function ajax() {        
        $this->set('title_for_layout', 'Upload: AJAX File Upload');
        $this->render('ajax');
    }
    
    public function ajax_upload($album_id = null, $album_title = null) {
        $this->set('album_id', $album_id);
        $this->set('album_title', $album_title);
        $album_id = 2;
        $upload_dir = "uploads/$album_id/";
    
        $this->autoLayout = $this->autoRender = false;
        $this->Uploader->setup(array('uploadDir' => "$upload_dir"));
        $data = $this->Uploader->upload($this->Uploader->ajaxField, array(
            'overwrite' => true,
            'name' => 'uploaderFilename'
        ));
        //Creating a thumb
        $thumb_name = $data['custom_name']."_thumb.".$data['ext'];
        $this->Uploader->resize(array('width' => 250, 'expand' => true, 'aspect' => true, 'append' => '_thumb'));
        if (!empty($data)) {
            $this->Picture->set($data);   
            if ($this->Picture->validates()) {
                // Upload successful
                $data["album_id"]= $album_id;
                $data['path_thumb'] = $upload_dir.$thumb_name;
                $this->Picture->save($data);
                header('Content-Type: application/json');
                echo json_encode(array('success' => true, 'data' => $data));                                
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How does this plugin works in translating to other language. I want to use
I want to use this jquery glow plugin in my page. (DEMO) and I
I want to use this Compass plugin https://github.com/aaronrussell/compass-rgbapng it requires Compass and Chunky Png?
Hello! I want to use this jQuery plugin http://jquery.vostrel.cz/reel I use stitched panorama. I
i want to use this plugin in my asp.net application i want to show
So I want to use this plugin http://docs.jquery.com/Plugins/autocomplete I want to retrieve all the
i want to use this plugin on my asp.net application. I am serializing my
If i define a plugin in the <build> tag and want to use this
I want to use this plugin here which displays a message stating if you
I want to use ckeditor plugin, and pagination in my application; but there is

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.