0

I have a Mule 4 application that receives a POST message with a form-data BODY, which is a path to a csv file.

Once the message is ingested and I try and read the payload all I get is the filepath and not the file contents.

I have tried many approaches including following these instructions here: https://dzone.com/articles/file-attachment-handling-in-mule-4-use-of-multi-pa but all I get are errors or the attachment name.

One specific example of what I have tried is this

payload.parts.'filename'.content

And I get the following output

~/Downloads/WithOnlyHouseBill.OUT

(This is the path to the file)

Please advise how I can read the actual file contents?

Thank you

  • You are saying you only get the path to the CSV file, so how do you expect to get the contents? You would need to use the path to somehow read it, with say, a file, FTP, or SFTP connector. If the contents of the file are not sent along in the multipart payload then there's no way to simply obtain them at that point. – afelisatti Aug 31 '22 at 22:48
  • Ah thank you - I thought that Postman grabbed the file contents and passed them in the message. Hmmm .... our Mule solution is in the Cloud and the file is on-prem. Gonna be fun trying to read the file :-) . Thanks again – smcodemeister Aug 31 '22 at 22:54
  • Depends on the actual request you are creating. If you are putting the content of the file in the request then it should not be a problem. – aled Aug 31 '22 at 23:04

1 Answers1

-1

Thanks to the respondents above. In the end it turned out to be my understanding of how Postman works. Postman does not include the actual data - only the path. So what I did was add an api-console control which opens the console window and allows me to attach a file. This takes it a step further than Postman and actually passes the file data as well. Thanks again

  • This is incorrect. Postman can send the data. See https://stackoverflow.com/a/16022213/721855 – aled Sep 01 '22 at 00:55