How get the path of a file to download it.

Hi,

I’m trying to get the path of a file so that can be downloaded, like pulgins.file.openFile does, but not triggering, I just want the path as: http://localhost:8183/resources/dynamic … clientnr=2. Sol this can be use on img tag or a tag for download for example. What I’m trying to achieve here? I just want to expose this file so people can download it. Ideally I would have something like: http://servername/download/filename.extension.

Thank you!

If that file resides on the server, have a look at plugins.file.getUrlForRemoteFile(jsFile)

jean:
Ideally I would have something like: http://servername/download/filename.extension.

http://servername points to the ROOT-folder of your tomcat installation, so you could create a download-folder in there and move your files to that folder.

Not sure if you’re aware of this, but in the application you can just use ```
plugins.file.writeFile(fileName, bytes)

patrick:
If that file resides on the server, have a look at plugins.file.getUrlForRemoteFile(jsFile)

I know Servoy has a function exposed in the API to directly write bytes to a temporary file on the server, and directly returning the URL
Is that something which could be exposed within Servoy as well?

Now you have to create a temp file first, seems twice the i/o to me.