}
public String uploadFile(String uri, String partName, String filename, String mimeType, byte[] contents, int expectedResponseCode) throws URISyntaxException, IOException {
try (CloseableHttpClient client = HttpClients.createDefault()) {
HttpPost post = new HttpPost(uri);
ByteArrayBody contentBody = new ByteArrayBody(contents, ContentType.create(mimeType), filename);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addPart(partName, contentBody);
post.setEntity(builder.build());
HttpResponse response = client.execute(post);
String result = EntityUtils.toString(response.getEntity());