FriendsOfCake/cakephp-upload

Saving model failed with no error

Closed this issue · 1 comments

Dear

I am using CakePHP 4 and updated recently.
I downloaded the Plugin using composer, install and load it OK.

Added field "file" as VARCHAR 255 into table in DB.
Added behavior in Table file

$this->addBehavior('Josegonzalez/Upload.Upload', [
            'file' => ['path' => 'webroot{DS}files{DS}'],
        ]);

Added field property in Entity class:

protected $_accessible = [
        'name' => true,
        'test_bs' => true,
        'file' => true,
    ];

Added form control in View

     <?= $this->Form->create($testA, ['type' => 'file']) ?>
            <fieldset>
                <legend><?= __('Add Test A') ?></legend>
                <?php
                    echo $this->Form->control('name');
                    echo $this->Form->control('test_bs._ids', ['options' => $testBs]);
                    echo $this->Form->control('file', ['type' => 'file']);
                ?>
            </fieldset>
            <?= $this->Form->button(__('Submit')) ?>
            <?= $this->Form->end() ?>

I also check the folders webroot/files exist, and writable.

However, saving the test model still fail. Is there any log file for debug? What can I check?

Thank you very much

Sorry everyone, I found root cause, the directory permissions are alright, but did not enable read/write in SELinux fcontext.
Fixing the SELinux blocking , the plugin works fine.