src/main/java/com/uploadcare/upload/FileUploader.java
public File upload() throws UploadFailureException {
        URI uploadUrl = Urls.uploadBase();
        HttpPost request = new HttpPost(uploadUrl);

        MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
        entityBuilder.addTextBody("UPLOADCARE_PUB_KEY", client.getPublicKey());
        entityBuilder.addTextBody("UPLOADCARE_STORE", store);
        if (file != null) {
            entityBuilder.addPart("file", new FileBody(file));
        } else if (stream != null) {
            entityBuilder.addBinaryBody("file", stream);
        } else {
            entityBuilder.addPart("file", new ByteArrayBody(bytes, filename));
        }
        request.setEntity(entityBuilder.build());

        String fileId = client.getRequestHelper()
                .executeQuery(request, false, UploadBaseData.class).file;
        return client.getFile(fileId);
    }
public File upload() throws UploadFailureException {
        URI uploadUrl = Urls.uploadBase();
        HttpPost request = new HttpPost(uploadUrl);

        MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
        entityBuilder.addTextBody("UPLOADCARE_PUB_KEY", client.getPublicKey());
        entityBuilder.addTextBody("UPLOADCARE_STORE", store);
        if (file != null) {
            entityBuilder.addPart("file", new FileBody(file));
        } else if (stream != null) {
            entityBuilder.addBinaryBody("file", stream);
        } else {
            entityBuilder.addPart("file", new ByteArrayBody(bytes, filename));
        }
        request.setEntity(entityBuilder.build());

        String fileId = client.getRequestHelper()
                .executeQuery(request, false, UploadBaseData.class).file;
        return client.getFile(fileId);
    }
Synchronously uploads the file to Uploadcare.

The calling thread will be busy until the upload is finished.

@return An Uploadcare file