【发布时间】:2017-05-30 13:09:57
【问题描述】:
我创建了一个输入类型为file 的表单,按钮提交以访问控制器中的功能,问题是我无法从该文件中获取数据。
当我打电话时在控制器中:
function displayAll() {
$adherents = $_FILES['file']['tmp_name'];
prd($adherents);
}
我发现了这个错误
未定义索引:文件 [APP\controllers\adherents.php,第 36 行]
这是视图:
<h2>Upload filer</h2>
<br>
<fieldset class="pano bleu">
<?php echo $this->Form->create('adherentsSuph', array('action'=>'displayAll'));?>
<?php
echo $this->Form->input('file', array('type' => 'file'));
echo $bouton->block(array(
'cancel'=>array('action'=>'index'),
'submit'=>array('id'=>'addAdherentFile')
));
echo $this->Form->end();?>
</fieldset>
【问题讨论】:
-
请始终提及您的确切 CakePHP 版本(vendor/cakephp/cakephp/VERSION.txt 或 lib/Cake/VERSION.txt 中的最后一行)
-
我在 CakePHP 1.3 下工作
标签: cakephp cakephp-1.3