cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve uploaded files from alfresco database?

kangkan
Champ in-the-making
Champ in-the-making

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 2

gdharley
Elite Collaborator
Elite Collaborator

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
Champ in-the-making
Champ in-the-making

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