junichi11/CakePHP-Plupload-Plugin — pull request #1 by aymericderbois (2012-12-21 15:51:26+00:00)
Title: Implement upload method in component

# New features

## Component

Upload method in component works alone and return 3 values :
* if the file is completly uploaded
* a json response
* information about file (same as $_FILE information)

### Example of use

``` php
Plupload->setUploaderOptions(array(
'locale' => 'fr',
'runtimes' => 'html5',
'filters' => array(),
'url' => '/uploaders/upload'
));
}

public function upload($folderId, $originalFilename = null) {
if ($this->Plupload->isPluploadRequest()) {
list($uploadFinished, $response, $file) = $this->Plupload->upload();
if ($uploadFinished) {
// Do what you want with your uploaded file
}
die($response);
}
}

}
```

## Controller

Upload action in plupload controller use the upload method in component. It works alone and send an event when file is completly uploaded.

It's perfect with simple uses because we just need to catch the event.

### Example of use

``` php
'saveUploadedFile',
);
}

public function saveUploadedFile($event) {
// Do what you want with your uploaded file
}
}
```

### Thanx

Thanx to @stephane-benoist for his help