作者 lyh

gx

... ... @@ -226,13 +226,11 @@ class FileController
public function downLoad(){
$file_model = new File();
$info = $file_model->read(['path' => str_replace_url($this->param['path'])]);
var_dump($info);
die();
if ($info === false) {
$this->response('指定文件不存在!', Code::USER_ERROR);
}
$url = getFileUrl($info['path'],$info['is_cos']);
$fileName = basename($url); // 要保存的文件名
$fileUrl = getFileUrl($info['path'],$info['is_cos']);
$fileName = basename($fileUrl); // 要保存的文件名
// 设置响应头
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
... ...