Created
March 6, 2009 10:32
-
-
Save mariuswilms/74856 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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