【发布时间】:2013-09-24 04:24:47
【问题描述】:
我正在使用 jose gonzalez 的 cakephp-upload plugin 将图像上传到我们的应用程序。默认情况下,它们被保存在这样的目录中:webroot/files/user/photo/{user_id} 这很好,除非我们想使用在 webroot/img 目录中搜索图像的$this->Html->image() 显示这些图像。
我已经尝试用
显示图像echo $this->Html->image('../files/user/photo/' .
$user['User']['photo_dir'] . '/' .
$user['User']['photo']);
这可行,但我想知道是否有某种方法可以告诉这个插件保存到 img 目录中?文档没有提到任何这些。
还有,有没有办法告诉$this->Form->input('User.photo', array('type' => 'file')); 只接受图像文件?
【问题讨论】: