Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Retrieving File Attachments from adobe adaptive form

Avatar

Level 4

How to get File Attachments from adobe adaptive form to maven project?

1 Accepted Solution

Avatar

Correct answer by
Employee

This is an easier and recommended way to get hold of the AF attachments on form submission. Please follow the steps mentioned below

Down load the sample bundle and deploy it using web console in AEM

Import the Sample Package using package manager. This package has the  custom submit 

Import the Sample Adaptive Form using the package manager. This adaptive form is configured to submit to the custom submit handler called

"handleafsubmission"

Preview the Test Attachments form . Add a couple of attachments and submit

The attachments will be written to the folder of your AEM installation

I have deleted my earlier response since this is the recommended approach

View solution in original post

33 Replies

Avatar

Level 9

You want to access attachments after the form is submitted?

are you using AEM workflow?

Avatar

Employee

When you add attachments to AF they are stored in tmp location. Every time an attachment is added to AF you can use the event handler to get the location of the file and write that location to the hidden field in your AF. When you form is submitted your servlet can extract the attachments from that location and do the needful

I am attaching a simple form with a custom client lib. Preview the form and add attachments.You should see the text field populated with the path to the attachments

https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:54646349-ac33-4d87-8813-95861ce78bfc

 

import the two packages using package manager

then preview the TestAttachments form

add a couple of attachments

you should see the path of the attachments written to the text box

 

Avatar

Level 4
where are the two packages? i just find adaptive form with name TestAttachments

Avatar

Level 4
Do I need to change the ٍSubmit Action from forms portal submit action To something else?

Avatar

Employee
are you familiar with AEM? you will need to write servlet and in that servlet you will have to fetch the attachments from that path

Avatar

Employee
i can give you some sample code- but it will be sometime next week

Avatar

Level 4

about first question Yes, But I tried a lot to get the attached files to the maven project using custom action servlet but I couldn't 
 

i want to get attachments in this servlet.

https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:0a7a542e-93b0-4aaf-9a5c-83272ded7552

Avatar

Employee
InputStream is = fileAttachment.getProperty("jcr:data").getBinary().getStream(); attachment = new com.adobe.aemfd.docmanager.Document(is);

Avatar

Level 4
com.aem.form.core.HandleForm hf = sling.getService(com.aem.form.core.HandleForm.class); hf.injestFormData(customer_ID,customer_Name,customer_Shipping_Address, customer_State,customer_ZIPCode,customer_Email); i mean this method (injestFormData )