CakePHP和PHP文件上传混乱

时间:2012-01-05 06:41:28

标签: php cakephp upload

在CakePHP视图中,当我尝试这段代码时

    <?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" />

有人可以解释一下原因吗?提前谢谢。

1 个答案:

答案 0 :(得分:3)

应该是:

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

(注意file周围的引号)