Răsfoiți Sursa

修改上传

huangtf 2 ani în urmă
părinte
comite
e77132f343

+ 5 - 8
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileUtils.java

@@ -488,19 +488,16 @@ public class FileUtils {
                     page = page + "-" + cursor + ".pdf";
                     String fileName = fileNameWithoutExtension +  "-" +  page;
                     String filePath = localPath + fileName;
+                    fos = new FileOutputStream(filePath);
+                    fos.write(out.toByteArray()); // 将数据写入到指定文件路径中
+                    fos.close();
                     if (newIOSSClient!= null ) {
-
-                        fos = new FileOutputStream(filePath);
-                        fos.write(out.toByteArray()); // 将数据写入到指定文件路径中
-                        fos.close();
                         //BladeFile bladeFile  = newIOSSClient.updateFile(out.toByteArray(),fileName);
-
                         BladeFile bladeFile  = newIOSSClient.uploadFile(fileName,filePath,OssConstant.ARCHIVE_DIRECTORY,projectId);
                         result.add(bladeFile.getLink());
+//                        File f = new File(filePath);
+//                        f.deleteOnExit();
                     }else {
-                        fos = new FileOutputStream(filePath);
-                        fos.write(out.toByteArray()); // 将数据写入到指定文件路径中
-                        fos.close();
                         result.add(filePath);
                     }