Reputation: 11
I creating Rest Web service for fetching attachment file through http and storing file to local drive so i need filename dynamically as it is come in http request My flow as follows
<foreach doc:name="For Each">
<set-payload value="#[payload.getInputStream() ]" doc:name="Get Inputstream from Payload"/>
<logger message="}}}#[message.inboundAttachments['payload']]" level="INFO" doc:name="Logger"/>
<file:outbound-endpoint path="F:\mule_data\e_files" responseTimeout="10000" doc:name="File" outputPattern="abcd.jpg"/>
</foreach>
<set-payload value="{"status":"success"}" doc:name="Generate JSON Response" />
</flow>
Here outputPattern="abcd.jpg" is harcoded so i need filename and format which coming through request Please help
i refer from https://blogs.mulesoft.com/dev/mule-dev/soap-rest-attachments/
Upvotes: 0
Views: 52
Reputation: 2832
Please go through my answer in the question linked below.
How send a file in an HTTP request and upload it to file server via FTP in Mule
Once you are able to read/get the attachment file,you can get all the metadata associated with file.For reading name you can do following-
use #[payload.dataSource.part.fileName] to get name of attachment.
Upvotes: 1