【发布时间】:2016-12-23 10:44:38
【问题描述】:
我们正在寻找使用 orbot 上传图片的解决方案。我们正在使用 Android 客户端来实现它,并使用服务器端 Spring Boot。当我们上传图片(3张或更多)时,即使上传了图片,我们也会在Android中得到Socket Exception。
这是 Spring 的示例代码:
public @ResponseBody Response addAttachments(@ModelAttribute("atForm") AtForm atForm, @RequestHeader(value="ts", required=false) String ts) throws Exception {
Response res = new Respose();
saveAttachments(atForm.getAtachments(), ts);
return response;
}
private void saveAttachments(MultipartFile[] attachments, String ts) {
if(attachments!=null && attachments.length > 0) {
for(MultipartFile file : attachments){
saveFile(file);
}
}
}
public String saveFile(MultipartFile mFile) throws IOException {
File convFile = new File(PATH+mFile.getOriginalName());
FileCopyUtils.copy(mFile.getBytes(), convFile);
return fileName.toString();
}
【问题讨论】:
-
显示一些代码 .. 你是如何上传的以及你遇到问题的地方。
-
更新我的原帖,请查收。
-
任何 cmets ??
标签: spring-boot orbot