1
對不起我的英語不好:(圖像與Spring和假死客戶受損
我要上傳與假死客戶端的圖像文件,但圖像在服務器上的應用程序損壞。
// CLIENT APP
@FeignClient(name = "media-client", url = "${api.base-path}/media")
public interface MediaClient {
@PostMapping
String uploadMedia(@RequestPart("file") MultipartFile file);
}
// SERVER APP
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
String uploadMedia(@RequestPart MultipartFile file) throws IOException {
Files.copy(file.getInputStream(), Paths.get("/home/m/Desktop").resolve(UUID.randomUUID().toString() + ".jpg"));
return null;
}
同一圖像保存客戶端應用程序和服務器應用程序,但結果如下:?
https://i.stack.imgur.com/xbiPS.png
什麼問題請大家幫我
我猜你已經在本地測試過這個文件,它在上傳之前沒有損壞? – sniperd
@sniperd是的,我已經在本地測試過文件。上傳後它已損壞。 – mkrgl