Search code examples
spring-bootorbot

Spring boot upload image using orbot


We are looking for a solution where uploading images using orbot. We are using Android client to implement it and server side spring boot is used. When we upload image (3 images or more), we get Socket Exception in Android even when the images are uplaoded.

Here is sample code for 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();
}

Solution


  •                  Spending few days of testing on it we found, this issue is related to network speed and work fine is network speed is good. So orbot network do not work on slow network.

    Thanks,
    Op