Answers for "ghow to upload image by using res template"

0

ghow to upload image by using res template

public String saveCompanylogo(File file){
        String url = COMPANY_URL+ "/saveCompanyLogo";
        MultipartEntity multiPartEntity = new MultipartEntity ();
        FileBody fileBody = new FileBody(file) ;
        //Prepare payload
        multiPartEntity.addPart("file", fileBody) ;
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.MULTIPART_FORM_DATA);
        HttpEntity<MultipartEntity> entity = new HttpEntity<MultipartEntity>    (multiPartEntity, headers);
        ResponseEntity<String> exchange = restTemplate.exchange(url,     HttpMethod.POST, entity,  new ParameterizedTypeReference<String>() {
        });
        return exchange.getBody();
    }
Posted by: Guest on March-31-2022

Code answers related to "ghow to upload image by using res template"

Browse Popular Code Answers by Language