FriendsOfCake/cakephp-upload

Translate Behavior : Cannot convert value of type Laminas\Diactoros\UploadedFile to string

RichardPiel opened this issue · 0 comments

Hello,

Is it possible to use Translate Behavior with cakephp-upload ?

I ask the question because i got this error while the save : Cannot convert value of type Laminas\Diactoros\UploadedFile to string

My Model :

        $this->addBehavior('Translate', [
            'fields' => [
                'file',
                'file_dir',
                'file_type',
                'file_size',
                'html',
                'slides_count',
            ],
        ]);

        $this->addBehavior('Josegonzalez/Upload.Upload', [
            'file' => [
                'path' => 'files{DS}ContentScorms{DS}file{DS}{field-value:file_dir}{DS}',
                'fields' => [
                    'type' => 'file_type',
                    'size' => 'file_size',
                ],
            ],
        ]);`

My form structure:

<input type="file" name="contents[0][content_scorm][file]" id="contents-0-content-scorm-file" class="form-control">
<input type="file" name="contents[0][content_scorm][_translations][en_US][file]" required="required" id="contents-0-content-scorm-translations-en-us-file" aria-required="true" class="form-control" spellcheck="false">

If i remove the second input file, all work correctly.

Thanks