Hi,
I’m using CakePHP Upload plugin. Currently, the configuration is set as follow:
$this->addBehavior('Josegonzalez/Upload.Upload', [
'poster' => [
'fields' => [
'dir' => 'poster_dir', // defaults to `dir`
//'size' => 'photo_size', // defaults to `size`
//'type' => 'photo_type', // defaults to `type`
],
'path' => 'webroot{DS}files{DS}{model}{DS}{field}{DS}{field-value:slug}',
],
]);
I can upload the image. However, in the poster_dir column, the input is something like:
webroot\files\Articles\poster\Test-8
What I need is to store only the {field-value: slug} in the poster_dir, not the whole path. I tried to remove the path as follows:
'path' => '{field-value:slug}',
The output is as expected, only {field-value: slug} is recorded into poster_dir, but the file is uploaded at the root directory, not in the webroot/files/Articles directory.
How can i capture the {field-value:slug} into the poster_dir and the file is uploaded into …webroot/files/{model}/{field-value:slug}
Thanks