CakePHP 3.6 File Upload Returns Missing field '...' in POST data

856 Views Asked by At

I am attempting to add a file/image upload form to my site, and I am getting the following error

Unexpected field 'uploadfile' in POST data, Missing field 'uploadfile.name, uploadfile.type, uploadfile.tmp_name, uploadfile.error, uploadfile.size' in POST data

from the following form code

<?= $this->Form->create(null, ['id' => 'save_upload_image', 'url' => "/research_station/save_upload_image", 'class' => 'upload-file']) ?>

    <div class="form-group">
        <?= $this->Form->control('uploadname', ['id' => 'uploadname']) ?>
    </div>

    <div class="form-group">
        <?= $this->Form->file('uploadfile', array('name' => 'uploadfile', 'type' => 'file')) ?>
    </div>

    <?= $this->Form->button('Upload', ['class' => 'btn btn-success btn-pill pull-right']) ?>

<?= $this->Form->end() ?>

Any ideas on what I am doing wrong?

0

There are 0 best solutions below