上传后,我试图在我的 cakephp 应用程序正文中查看 PDF 文件,更像是 iframe。上传工作正常,但我现在面临的挑战是打开 pdf 文件。
这是我的控制器中的上传功能,它工作正常
function uploadFile() {
$file = $this->data['QmsProcedureKnowledgeManagement']['file'];
if ($file['error'] === UPLOAD_ERR_OK) {
$id = String::uuid();
if (move_uploaded_file($file['tmp_name'], APP . 'qms_procedure_km/' . $file['name'])) {
$this->request->data['QmsProcedureKnowledgeManagement']['filename'] = $file['name'];
$this->request->data['QmsProcedureKnowledgeManagement']['filesize'] = $file['size'];
$this->request->data['QmsProcedureKnowledgeManagement']['filemime'] = $file['type'];
return true;
}
}
return false;
}
这就是我尝试在 view.ctp 中查看 pdf 的方式
<?php echo $this->Html->link(APP.'qms_procedure_km/'. $qmsProcedureKnowledgeManagement['QmsProcedureKnowledgeManagement']['filename']); ?>
先感谢您