Cakephp 文件输入不提供所有文件信息

Cakephp 文件输入不提供所有文件信息,cakephp,cakephp-2.0,Cakephp,Cakephp 2.0,在我的表格中,我有: <input type="file" name="data[Speciality][background_image]" id="background_image" class="hide"> 正如您所看到的,只提供了文件名,它应该是这样的: [name] => test.jpg [type] => image/jpeg [tmp_name] => C:\server\tmp\php5A.tmp [error] => 0 [size]

在我的表格中,我有:

<input type="file" name="data[Speciality][background_image]" id="background_image" class="hide">
正如您所看到的,只提供了文件名,它应该是这样的:

[name] => test.jpg
[type] => image/jpeg
[tmp_name] => C:\server\tmp\php5A.tmp
[error] => 0
[size] => 560

怎么了?

您可能忘记阅读有关如何处理文件上载的文档

确保在create()方法中有type=>文件:

[name] => test.jpg
[type] => image/jpeg
[tmp_name] => C:\server\tmp\php5A.tmp
[error] => 0
[size] => 560
echo $this->Form->create('Speciality', array('type' => 'file'));