This plugin is to help make using filepicker.io even easier with cakePHP.
- Cake 2.0+
- PHP 5.3+
-
Download the latest version, extract/uncompress it, and move it into
app/Plugin/Filepicker/
-
Clone the repo ito the
app/Plugin/Filepicker/
folder.From the 'app/Plugin' folder:
git clone git@github.com:Filepicker/filepicker-cakephp.git Filepicker/
//app/Config/bootstrap.php
CakePlugin::load('Filepicker');
-
Create an account at Filepicker.io and get an apikey.
-
Copy the example file from
app/Plugin/Filepicker/Config/filepicker.php.example
toapp/Config/filepicker.php
$config = array( 'Filepicker' => array( 'apikey' => 'YOUR_API_KEY', ) );
Add the Filepicker helper to your app controller.
<?php
class AppController extends Controller {
public $helpers = array('Filepicker.Filepicker');
}
Insert the script tag into your view. For best performance, you should insert it at the end of the body, before the </body>
tag.
<?php
echo $this->filepicker->scriptTag();
Where ever you have your form, you can insert a filepicker type tag.
echo $this->Form->input('attachment', array(
'type' => 'filepicker',
'data-fp-mimetypes' => "*/*",
));
For more options to put into the array, look at the filepicker documentation on the open widget
It will put a url into your form, which you can store into your database.