I am using JDeveloper. Within an ADF Fusion Web Application I have an Input File control and a Send button which calls a bean method to upload the file to the UCM. If my file is located on my machine, let's say "/home/user/myfile.txt", it works like a charm. If I am trying to use a Input File, I do not see anywhere how to upload the file to the UCM without first saving this file to the disk and then upload this file. In my opinion, this way of doing thing is not recommended.
Here is the code I have so far which is able to upload a file coming from the server workstation :
// RETRIEVE THE DESTINATION PATH
DataBinder binder = idcClient.createBinder();
binder.putLocal("IdcService", "COLLECTION_INFO");
binder.putLocal("hasCollectionPath", "true");
binder.putLocal("dCollectionPath", "/Contribution Folders/PDD"); // The path you are looking for
DataBinder searchFolder = idcClient.sendRequest(idcContext, binder).getResponseAsBinder();
binder = idcClient.createBinder();
binder.putLocal ("IdcService", "CHECKIN_NEW");
binder.putLocal ("dDocAuthor", "weblogic");
binder.putLocal ("dDocTitle", "myimage2.jpg");
binder.putLocal ("dDocName", "myimage2.jpg");
binder.putLocal ("dDocType", "Document");
binder.putLocal("xCollectionID", searchFolder.getLocal("dCollectionID"));
binder.putLocal ("dSecurityGroup", "Public");
binder.putLocal ("dDocAccount:", "");
binder.putLocal ("xComments", "My comment");
binder.addFile ("primaryFile", new File("/home/oracle/myimage.jpg"));
// check in the file
ServiceResponse response = idcClient.sendRequest (idcContext, binder);
If you have any suggestion, I would appreciate a lot. Thanks guys!
Here is the solution :
UploadedFile uf = (UploadedFile) inputFile1.getValue();
DataBinder binder = idcClient.createBinder();
binder.putLocal ("IdcService", "CHECKIN_NEW");
binder.putLocal ("dDocAuthor", "weblogic"); // if user is admin, can specify other user
binder.putLocal ("dDocTitle", uf.getFilename());
binder.putLocal ("dDocName", uf.getFilename());
binder.putLocal ("dDocType", "DigitalMedia");
binder.putLocal("xCollectionID", getFolderCollectionId("/Contribution Folders/PDD")); // parent's folder
binder.putLocal ("dSecurityGroup", "Public");
binder.putLocal ("dDocAccount:", "");
binder.putLocal ("xComments", "Montreal comment");
binder.putLocal ("xWCTags", "Montreal");
binder.addFile ("primaryFile", new TransferFile(uf.getInputStream(), uf.getFilename(), getByteLenght(uf.getInputStream())));
ServiceResponse response = idcClient.sendRequest (idcContext, binder);