Can I use storeURLToFileDocument to retrieve a file from the server?

0
I used it in my development environment and it worked fine. In the Mendix PRIVATE cloud, I can't figure out how to get to the file. I made an extra directory in data/files called demo. The URL I use to get to that file is combined of the outcome of GetApplicationUrl + srv/mxinstances/frattest/data/files/demo/ + filename (and numereous other combination I tried). He does not complain (anymore) about the way the URL is formed, iow it is well formed. This is the error I get: com.mendix.core.CoreRuntimeException: java.io.FileNotFoundException: https://fraternit-test.mendix.nl/srv/mxinstances/frattest/data/files/demo/Test.xls Anybody knows how to do this? Thanks for reading.
asked
2 answers
1

Try the model-upload directory. I know you can store the data there. We use this place all the time to get files from the private cloud into the application. And you only have to use the last part ie /srv/mxinstances/yourownapp/data/model-upload Do mark the / or . Use \C:\path\path\ for local and //path/path/ for linux.

Regards,

Ronald

answered
1

You can not directly access files on the server from a remote app (that would be a huge security risk!). You can access them do through the usual 'appurl/file?fileid=number' api, but only if you have a client session. If you want to provide direct access to a file which doesn't require users to be logged in, you could publish a microflow that takes fileid (or something that makes more sense to externals) as input argument and returns the file using the REST services module. That should combine nicely with the storeURLToFileDocument api.

answered