Easily upload files to a directory and save the filename to database attribute.
In your ORM Model:
use Shared\FileField\HasFileFieldsTrait;
public $files = array(
'image' => array(),
'poster' => array(
'path' => 'uploads/:class_slug/:attribute/:unique_id-:file_name',
'defaultPath' => 'uploads/default.png'
)
);In your Controller:
$model = new Poster();
if (Input::hasFile('poster')) {
$model->poster = Input::file('poster');
}
$model->save();Each field can have filesystem path pattern and default path options. If you don't specify any of them, they will be loaded from default config.
The MIT License (MIT). Please see License File for more information.