I have this code below and I want to know how to be able to get additional response other than the set Boolean
value:
public Single<Boolean> uploadFile(String entityType, String entityId, String blobName){
return Single.create(e -> {
uploadElement = DOM.createElement("input");
uploadElement.setAttribute("type", "file");
uploadElement.setAttribute("accept", "*/*");;
Event.sinkEvents(uploadElement, Event.ONCHANGE);
Event.setEventListener(uploadElement, event -> {
final FileObject fileObject = (FileObject) getFile(event);
log("Name=" + fileObject.getName());
log("Type=" + fileObject.getType());
log("Size=" + fileObject.getSize() + "");
readAsDataURL((FileObject) fileObject, new FileReaderCallback() {
@Override
public void onLoad(String data) {
Entity entity = new Entity(entityType);
entity.setEntityId(entityId);
entity.setBlobProperty(blobName, data).subscribe(isSuccess -> {
e.onSuccess(isSuccess);
}, error -> {
e.onError(error);
});
}
});
});
click();
});
}
I need to be able to get the FileObject
also in the process, how can I do that in RxJava?