public void uploadImage(MultipartFile file,Long chequeID,String username){
  if (!file.isEmpty()) {
    Photo photo=new Photo();
    try {
      photo.setBytes(file.getBytes());
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    photo.setName(file.getOriginalFilename());
    photo.setContentType(file.getContentType());
    photo.setChequeId(chequeID.toString());
    photo.setUsername(username);
    photo.setAddDate(OffsetDateTime.now());
    photoRepository.save(photo);
  }
}

public void uploadImage ( MultipartFile file , Long chequeID , String username ) { if ( ! file . isEmpty ( ) ) { Photo photo = new Photo ( ) ; try { photo . setBytes ( file . getBytes ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } photo . setName ( file . getOriginalFilename ( ) ) ; photo . setContentType ( file . getContentType ( ) ) ; photo . setChequeId ( chequeID . toString ( ) ) ; photo . setUsername ( username ) ; photo . setAddDate ( OffsetDateTime . now ( ) ) ; photoRepository . save ( photo ) ; } }
method uploadimage async take uploaded images and save it to mongodb
