0
我试图在上传到应用文件夹下的标志文件夹后回显图片。上传工作正常,但我现在面临的挑战是回应视图中的图像。以下是我的上传功能和视图代码上传后在cakephp中回显图片
function uploadFile() {
$file = $this->data['Logo']['file'];
if ($file['error'] === UPLOAD_ERR_OK) {
$id = String::uuid();
if (move_uploaded_file($file['tmp_name'], APP.'logos'.DS.$id)) {
$this->request->data['Logo']['filename'] = $file['name'];
$this->request->data['Logo']['filesize'] = $file['size'];
$this->request->data['Logo']['filemime'] = $file['type'];
return true;
}
}
return false;
}
并为视图代码,我使用此代码。
<?php echo $this->Html->image(APP. 'logos' . DS. $logo['Logo']['filename']); ?>
感谢您的帮助,您将提供。
谢谢Danial it works – Mhofhands 2013-02-14 09:53:16