You have Composer installed on your machine.
Composer autoload is enabled. In application/config/config.php
make sure $config['composer_autoload']
is set to FCPATH.'vendor/autoload.php'
(or whatever path you have composer installed in).
The url
helper is loaded in application/config/autoload.php
($autoload['helper'] = array('url');
).
$config[base_url']
in application/config/config.php
.Copy the assets
folder to your CodeIgniter root directory and the uploader
folder into your application/third_party
directory.
Edit your composer.json
file and add the following line to the psr-4
autoload:
"Hazzard\\Filepicker\\": "application/third_party/uploader/src"
It should look like this.
Then run:
composer require hazzard/config
composer require intervention/image 2.2.*
composer require symfony/http-foundation 2.6.*
composer dumpautoload
Create a Filepicker
controller and add:
<?php
use Hazzard\Filepicker\Handler;
use Hazzard\Filepicker\Uploader;
use Intervention\Image\ImageManager;
use Hazzard\Config\Repository as Config;
class Filepicker extends CI_Controller
{
/**
* Handle an incoming HTTP request.
*/
public function index()
{
$handler = new Handler(
new Uploader($config = new Config, new ImageManager)
);
$config['debug'] = true;
// Path to the files directory (files).
$config['upload_dir'] = FCPATH . 'files';
// Url to the files directory.
$config['upload_url'] = base_url('/files');
// Handle the request.
$handler->handle()->send();
}
}
In your view make sure to set the url option to "<?php echo site_url('filepicker') ?>"
(or whatever route you choose).