Download file

0
Hi everybody,  When my client click in a "Generate button" I want to create a file in tmp folder than dowload it throw  the client browser finally delete it. I use a create a java action to create File in tmp folder. File file = new File(com.mendix.core.Core.getConfiguration().getTempPath() + "/test.txt"); Now, i want to download this file. Have you an idea to make it ? 
asked
2 answers
0

Any specific reason why you need to create the file outside of Mendix? You could save you a lot of time by doing everything inside of Mendix. But if you still want to do it outside of Mendix create in the Java action a Mendix filedocument and return that document to Mendix so you can pick it up in a microflow there. So you get this setup: Generate button calls microflow with Java action that returns a Mendix filedocument so you can use the download action (with delete after download option to true).

And see the community commons GetFileContentsFromResource on how to return a Mendix filedocument.

Regards,

Ronald

answered
0

I create the file outside of Mendix, because inside of Mendix with a FileDocument, the result is a corrupted file. 
I make another post with more information about it for getting some helps (link above)

https://forum.mendix.com/link/questions/90118

I didn't try to create FileDocument with the community commons GetFileContentsFromResource, I'll try immediatly ! 

Thanks for your answer

 

answered