Skip to content

Instantly share code, notes, and snippets.

@mariuswilms
Created March 6, 2009 10:32
Show Gist options
  • Save mariuswilms/74856 to your computer and use it in GitHub Desktop.
Save mariuswilms/74856 to your computer and use it in GitHub Desktop.
<?php
// app/models/example.php
class Example extends AppModel {
var $actsAs = array('Media.Transfer');
}
// For single uploads
// app/controllers/examples_controller.php
class ExamplesController extends AppController {
function edit($id = null) {
....
// $this->data = array('Example' => array(..., 'file' => transferable item, ...));
$this->Example->save($this->data);
....
}
}
// For multiple uploads at once
// app/controllers/examples_controller.php
class ExamplesController extends AppController {
function edit($id = null) {
....
// $this->data = array(
// 'Example' => array(
// 0 => array(..., 'file' => transferable item1, ...),
// 1 => array(..., 'file' => transferable item2, ...),
// ...
// ));
$this->Example->saveAll($this->data, array('validate' => 'first'));
....
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment