这是我写的方法
public FileUploadResponse uploadFile(
String uploadPath, String fileName, MultipartFile file) throws IOException {
FileInputStream ins1 = null;
try {
File file1 = new File("C:\\Users\\Administrator\\Pictures\\logo111.jpg");
file.transferTo(file1);
ins1 = new FileInputStream(file1);
String sha256 = DigestUtils.sha256Hex(ins1);
JSONObject requestData = new JSONObject();
requestData.put("filename",file1.getName());
requestData.put("sha256",sha256);
String meta = JSONObject.toJSONString(requestData);
FileUploadService fileService = new FileUploadService.Builder().config(config).build();
FileUploadResponse fileUploadResponse = fileService.uploadImage(file1.getPath(), meta,file1.getPath() );
return fileUploadResponse;
}catch (Exception e){
e.printStackTrace();
return null;
}finally {
IOUtils.closeQuietly(ins1);
}
}
一直返回url字符串无效
java.lang.IllegalArgumentException: The urlString passed in when building httpRequest is invalid:C:\Users\Administrator\Pictures\logo111.jpg
at com.wechat.pay.java.core.http.HttpRequest$Builder.url(HttpRequest.java:120)
at com.wechat.pay.java.service.file.FileUploadService.uploadFile(FileUploadService.java:142)
at com.wechat.pay.java.service.file.FileUploadService.uploadImage(FileUploadService.java:111)
求问大佬这是怎么回事