word,excel预览
This commit is contained in:
+2
-5
@@ -293,20 +293,17 @@ public class CommonController {
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
String fileName = "";
|
||||
//本地下载
|
||||
String filePath = ossFile.getUrl();
|
||||
File file = new File(filePath);
|
||||
if(!file.exists()){
|
||||
if(!CosBootUtil.doesObjectExist(filePath)){
|
||||
response.setStatus(404);
|
||||
throw new RuntimeException("文件不存在..");
|
||||
}
|
||||
// 文件名称
|
||||
fileName = file.getName();
|
||||
inputStream = new BufferedInputStream(new FileInputStream(filePath));
|
||||
response.setContentType("application/force-download");// 设置强制下载不打开
|
||||
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1"));
|
||||
inputStream = new BufferedInputStream(new FileInputStream(filePath));
|
||||
inputStream = CosBootUtil.download(filePath);
|
||||
outputStream = response.getOutputStream();
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
|
||||
Reference in New Issue
Block a user