Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
RichardPiel opened this issue Jul 12, 2023 · 0 comments

Comments

@RichardPiel
Copy link

RichardPiel commented Jul 12, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant