The fileName for a FileDocument object shows empty from an operation of PublishedRESTService.

0
Hi, Makers I created a PublishedRESTService that accepts binary files using the POST method.   The microflow is designed as shown below screenshot. The file content is saved without a filename if I run the REST API from Swagger or PostMan. It shows the correct file size, but no filename is retrieved.   Do you have any idea about this case? I really appreciate any help you can provide.    
asked
2 answers
2

Hey Yongpyo,

 

That's correct, you won't be getting fileName of that document object entity because Mendix is only receiving the contents of file in binary format, it won't be containing the file name in it. Upon receiving the contents, Mendix will create new file object and load the contents into it with empty file name.

 

Resolution - I had the similar requirement and what I did was, for file contents, I take input as json with two fields - file name and file contents. Upon receiving the request, I apply import mapping and convert it into Mendix file object and then assign name as well accordingly.

answered
0

I tried to extract the filename from the posted request using JavaAction.

image.png

 

image.png

 

image.png

 

It worked as I expected.

Thank you, guys.

answered