How to read files using HTTP Listener in Mule 4?

Author: Abhishek Bathwal

This blog will help us understand how we can create mule applications that read files using HTTP Listener.


Created RAML using the MIME Type as multipart/form-data and generate a flow.

The dataweave in the flow is printing the complete payload in Json format:


Will test 3 different file formats which are .txt, .csv and .pdf with simple messages:

.txt   .csv       .pdf

Using postman to hit the application.

In Postman we will choose the method as POST and Body as form-data. For Key and Value first need to hover over the key area and select File. As we have not defined any form parameter to define as the key name or field name in RAML we can give any name as key and select the file.

Sending Single File:

Response :

Next Step: We will try to set some form parameter to be used as a key while uploading the file. For this, we need to make some modifications to the RAML.

Modified RAML:

Making call with correct parameter:

Making call with wrong parameter:

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.