DAM file InputStream is not reflecting original content in document management systems like Dropbox
Hi All,
Is there any way to upload a file directly from AEM DAM location like "/content/dam/myFiles" to document management system like Dropbox.
I referred this article http://www.tothenew.com/blog/making-dropbox-documents-available-in-aem/ for "Making Dropbox documents available in AEM".
Using above article I'm able to download dropbox file into AEM DAM successfully, now I'm trying to upload a file from DAM location to Dropbox.
I referred the Dropbox Java Core API v2 as well and found following code for uploading a file to Dropbox :
// Upload "test.txt" to Dropbox
InputStream inputStream = new FileInputStream("test.txt");
FileMetadata metadata = client.files().uploadBuilder("/test.txt").uploadAndFinish(inputStream);
In above code, InputStream is required to upload a file into Dropbox, which is I'm able to retrieve using Asset Interface method getOriginal()
...
Asset asset = resource.adaptTo(Asset.class);
Resource original = asset.getOriginal();
InputStream inputStream = original.adaptTo(InputStream.class);
...
Here when I'm passing this retrieved InputStream from AEM into Dropbox upload method "uploadAndFinish(inputStream)", It is not uploading the file with its original form but as encrypted or corrupted form.
Please provide your suggestion and answers.
I'm Using AEM 6.2 instance.
Thanks,
Arpit Bora