Skip to content

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

@RichardPiel

Description

@RichardPiel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions