2012-01-05 76 views
0

在CakePHP视图,当我尝试这个代码的CakePHP和PHP文件上传混乱

<?php echo $form->input('download_link', array('type'=>file)); ?>> 

其HTML输出

<input type="file" name="data[Publication][download_link]" value="" id="PublicationDownloadLink" /> 

不工作

但在同样的观点平原HTML表单正在工作

<input type="file" name="download_link" class="engInput" /> 

有人可以解释为什么吗?提前致谢。

+0

谢谢你的快速回复。但它仍然无法正常工作。请再次看看这个问题,我已经更新了它。 – nepalipunk 2012-01-05 06:56:05

+1

“不工作”是什么意思?它正在输出html,因为它是假设的。 – Vigrond 2012-01-05 07:13:34

+0

在控制器中,如果我把这个代码 'code' $ test = $ _ FILES [“download_link”] [“type”]; var_dump($ test); 'code' CakePHP代码返回null,但纯HTML返回文件类型。 – nepalipunk 2012-01-05 09:52:58

回答

3

它应该是:

input('download_link', array('type'=>'file')); 

(注意周围file引号)