How get the path of a file to download it.

Questions, answers, tips and ideas on Servoy Client

How get the path of a file to download it.

Postby jean » Wed Apr 27, 2022 6:15 pm

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!
jean
 
Posts: 2
Joined: Mon Mar 14, 2022 4:18 pm

Re: How get the path of a file to download it.

Postby patrick » Wed Apr 27, 2022 6:31 pm

If that file resides on the server, have a look at plugins.file.getUrlForRemoteFile(jsFile)
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3694
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How get the path of a file to download it.

Postby Joas » Tue May 17, 2022 3:14 pm

jean wrote: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
Code: Select all
plugins.file.writeFile(fileName, bytes)
to push the file as a download.
Joas de Haan
Yield Software Development: Need help on your project?
yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 836
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL


Return to Servoy Client

Who is online

Users browsing this forum: No registered users and 1 guest

cron