How to retrieve uploaded files from alfresco database?

cancel
Showing results for 
Search instead for 
Did you mean: 
kangkan
Member II

How to retrieve uploaded files from alfresco database?

Made a process to upload a file.

Also added a execution listener to the process.

I want to know how to retrieve the uploaded file by execution listener

Below is my code for execution listener

I want to know how to get that file from database.

I want to know about java libraries to access file from database

Thank you in advance

2 Replies
gdharley
Intermediate

Re: How to retrieve uploaded files from alfresco database?

If you have an attachment ID (from when you uploaded the attachment), then you can use the taskService 

taskService.getAttachment(attachmentId);

If this returns not null, then you can get the attachment content using:
InputStream attachmentStream = taskService.getAttachmentContent(attachmentId);

Hope this is what you were looking for,

Greg

kangkan
Member II

Re: How to retrieve uploaded files from alfresco database?

Hi,

Thank you

I may need more help regarding this as I am new to this.

Can you please please provide the full implementation of this.

I am doing something like this

Also how do you get the attachment id provide you know the form id

TaskService taskService  = processEngine.getTaskService();

if(taskService.getAttachment("uploadurl")!=null){

InputStream attachmentStream = taskService.getAttachmentContent(attachmentId);

}

Here uploadurl is the form id for file upload

I think I am not doing it right

Please help