Different from Mule 3, Mule 4 does not have the attachments in the Mule event. This article gives an example of how to extract the HTTP attachments, read them and write them to local files.
Assuming mule app's listening on http://localhost:8081/test, below's the PostMan request:
<http:listener doc:name="Listener" doc:id="62702d1c-a913-40bb-9b53-baef97099c65" config-ref="HTTP_Listener_config" path="/test"/>
<ee:transform doc:name="Transform Message" doc:id="3cdb42df-8c13-44c5-8575-9617c7842349" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/java
var payloadParts=payload pluck($) default []
---
payloadParts[0] pluck($) default []]]></ee:set-payload>
</ee:message>
</ee:transform>
Note:
<foreach doc:name="For Each" doc:id="77f6eeb0-6af3-4d4d-86c1-c71a17d6ba13">
<logger level="INFO" doc:name="Logger" doc:id="ad801e73-c208-464f-9641-dbaa1b5191eb" message='#[payload.headers."Content-Disposition".filename]' />
<file:write doc:name="Write" doc:id="7bab023a-d246-4afd-a60b-f348aaf52b3d" config-ref="File_Config" path='#[payload.headers."Content-Disposition".filename]'>
<file:content><![CDATA[#[payload.content]]]></file:content>
</file:write>
</foreach>
The payload in the "foreach" component is a map with 2 keys: headers and content. We could get information about the attachment from the headers, for example, filename:
payload.headers."Content-Disposition".filename
001114538

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.