Hi everyone,
i have a little problem with my file upload.
I have Tickets with multiple TicketSnaps. Each TicketSnap can also have a uploaded picture or pdf.
I want that all pictures go into one folder named as the Ticket.
I thought this line would do it.
'path' => 'webroot/uploads/{field:ticket_id}', // Create a folder for each ticket
but as you can see in the pictures my folders are now named
{field:ticket_id}
Here the full function
public function initialize(array $config): void
{
parent::initialize($config);
$this->setTable('ticket_snaps');
$this->setDisplayField('id');
$this->setPrimaryKey('id');
$this->addBehavior('Timestamp');
$this->belongsTo('Tickets', [
'foreignKey' => 'ticket_id',
'joinType' => 'INNER',
]);
$this->belongsTo('Users', [
'foreignKey' => 'user_id',
'joinType' => 'INNER',
]);
$this->addBehavior('Josegonzalez/Upload.Upload', [
'photo' => [
'path' => 'webroot/uploads/{field:ticket_id}', // Create a folder for each ticket
],
]);
}
The ticket_id should be present and is stored correct in the DB.
Thank you