CakePHP 3.6文件上传在POST数据中返回缺少的字段'...'

时间:2019-03-16 03:41:20

标签: cakephp cakephp-3.x cakephp-3.6

我正在尝试将文件/图像上传表单添加到我的网站,但是出现以下错误

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

使用以下表单代码

<?= $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() ?>

关于我在做什么错的任何想法吗?

0 个答案:

没有答案