add(req-2080):创建文件夹---修改路径

This commit is contained in:
胡朝飞 2024-01-22 12:26:37 +08:00
parent a10a32c45e
commit d8ee4faf51

View File

@ -31,6 +31,7 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -668,11 +669,12 @@ public class FileServiceImpl implements FileService {
absolutePath = tempDirectory + SEPARATOR + fileName;
}*/
String absolutePath = rootDir + SEPARATOR + fileName;
String absolutePath = rootDir + fileName;
log.info("临时文件夹,{}", absolutePath);
// 创建输出流并写入数据
OutputStream output = Files.newOutputStream(Paths.get(absolutePath));
// OutputStream output = Files.newOutputStream(Paths.get(absolutePath));
OutputStream output = new FileOutputStream(absolutePath);
byte[] buffer = new byte[1024];
int length;
while ((length = input.read(buffer)) > 0) {