|
@@ -292,13 +292,14 @@ class FileController |
|
@@ -292,13 +292,14 @@ class FileController |
|
292
|
$this->response('指定文件不存在!', Code::USER_ERROR);
|
292
|
$this->response('指定文件不存在!', Code::USER_ERROR);
|
|
293
|
}
|
293
|
}
|
|
294
|
if($info['is_cos'] == 1){
|
294
|
if($info['is_cos'] == 1){
|
|
295
|
-
|
295
|
+ $cos = new CosService();
|
|
|
|
296
|
+ return $cos->downloadFile($info['path']);
|
|
296
|
}else{
|
297
|
}else{
|
|
297
|
$fileUrl = $this->config['root'].'/'.$info['path'];
|
298
|
$fileUrl = $this->config['root'].'/'.$info['path'];
|
|
298
|
if (!is_file($fileUrl)) {
|
299
|
if (!is_file($fileUrl)) {
|
|
299
|
$this->response('指定文件已被系统删除!', Code::USER_ERROR);
|
300
|
$this->response('指定文件已被系统删除!', Code::USER_ERROR);
|
|
300
|
}
|
301
|
}
|
|
301
|
- $fileName = 'downloaded_file'.'.'.$info['type']; // 要保存的文件名
|
302
|
+ $fileName = basename($info['path']); // 要保存的文件名
|
|
302
|
// 设置响应头
|
303
|
// 设置响应头
|
|
303
|
header('Content-Type: application/octet-stream');
|
304
|
header('Content-Type: application/octet-stream');
|
|
304
|
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
305
|
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|