Asset upload workflow. to accept the path of the file and save it in the DAM. | Community
Skip to main content
Pavan_Kalyan-1
Level 3
March 30, 2022
Solved

Asset upload workflow. to accept the path of the file and save it in the DAM.

  • March 30, 2022
  • 1 reply
  • 1473 views

Hi Team,

I want to create a workflow to accept the file in the frontend page upon clicking the button. the files should be uploaded to the dam.

can anyone help on it (any sample code will be helpful).

 

Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by DEBAL_DAS

I would follow the below steps for the above mentioned requirements -

 

1. I will create a File Upload component with the ability for the user or the author to browse the file.

2. Upon clicking on upload button I will make post request from File Upload component to custom servlet to trigger my workflow. In this servlet I will capture that uploaded file name and construct payload path as mentioned here -

https://aem.redquark.org/2019/12/workflows-in-aem-05-trigger-workflow.html

3. Finally my custom workflow model(process step) will upload the files to the DAM using below approach -

 

Please consider one more point if someone try to upload same file then do you want to show any message.

1 reply

DEBAL_DAS
New Member
March 30, 2022

Is there any specific reason you want to write workflow here? 

I feel without having workflow you can achieve the same.

You can make post request while uploading the file to custom servlet and that will persist the file in DAM using AssetaManager API.

 

Please review below method to perform upload operation-

https://github.com/Adobe-Consulting-Services/acs-aem-tools/blob/master/bundle/src/main/java/com/adobe/acs/tools/csv_asset_importer/impl/CsvAssetImporterServlet.java#L484

 

Hope it will help you.

Debal Das, Senior AEM Consultant
Pavan_Kalyan-1
Level 3
March 31, 2022

Hi @debal_das 

My requirement is to create a workflow to upload files to the DAM.

and user should be able to use it from the page.

let's say a component. and it should give the ability for the user or the author to browse the file and upon clicking on the button it should upload the image to the DAM.

 

Thanks.

DEBAL_DAS
DEBAL_DASAccepted solution
New Member
March 31, 2022

I would follow the below steps for the above mentioned requirements -

 

1. I will create a File Upload component with the ability for the user or the author to browse the file.

2. Upon clicking on upload button I will make post request from File Upload component to custom servlet to trigger my workflow. In this servlet I will capture that uploaded file name and construct payload path as mentioned here -

https://aem.redquark.org/2019/12/workflows-in-aem-05-trigger-workflow.html

3. Finally my custom workflow model(process step) will upload the files to the DAM using below approach -

 

Please consider one more point if someone try to upload same file then do you want to show any message.

Debal Das, Senior AEM Consultant