Generates a download link for a file that the user specifies.

See also Create a file with a secure download link

Syntax

XIH.GetDownloadUrl(fileName)

XIH.GetDownloadUrl(fileName, absoluteUrl)

XIH.GetDownloadUrl(fileName, oneTimeDownload)

XIH.GetDownloadUrl(fileName, availabilityPeriodMinutes)

XIH.GetDownloadUrl(fileName, absoluteUrl, oneTimeDownload, availabilityPeriodMinutes)

Parameters

Parameter

Data type

Description

Sample

fileName

string

String specifies the name of a file chosen by the user

"file.txt"

absoluteUrl

bool

If set on true the link will be generated using the hostname and port instead of the relative link from the TIS Board

false

oneTimeDownload

bool

Specifies if it is a one time link or if it can be used infinitely. Default =   infinitely

false

availabilityPeriodMinutes

int

Specifies the time the link will be available. The default is 1 day.

Everyday at midnight all files are deleted by a cronjob regardless of their value in this parameter!

1440

Remarks

Usable on version 6.8 and above.

You can get the path where your file should be put using: XIH.GetAppSetting("TisScratchSpacePath")

Data in the "TisScratchSpacePath" will be cleaned up by a "CronJob" at midnight everyday. This happens independently form the "availabilityPeriod" of the download links.

Examples

For this example to work you need an existing file in a specific folder. The path for the folder can be obtained using XIH.GetAppSetting("TisScratchSpacePath").

"<a href="+(char)34+XIH.GetDownloadUrl("DownloadfileXIH.txt", false, false, 60)+(char)34+">Link</a>"

Now you should get a html string with a path in it. Just go to the TIS Board using the checkbox "TIS Board" and click on the blue plus.

Then you can select the HTML selection method and use it directly in HTML.