DownloadURL - cLocalWebResourceManager
Generates a unique and secure URL from downloading a file
Type: Function
Return Data Type: String
Parameters
| Parameter | Type | Description |
|---|---|---|
| sPath | String | The local full path name of the file to be loaded to your client |
Syntax
Function DownloadURL String sPath Returns String
Call Example
Get DownloadURL sPath to StringVariable
Description
DownLoadURL is used to create an encrypted URL that can be used by the resource manager to download this file to the client. You pass it a local file name and it returns an encrypted URL.
Folders must be registered using RegisterDownloadFolder before files can be downloaded from them.
Object oButton is a cWebButton
Set psCaption to "View Prices"
Procedure Ok
String sPath sUrl
Move "C:\Catalog\Pricelist.pdf" to sPath
// Builds an encrypted URL based on the file path
Get DownloadURL of ghoWebResourceManager sPath to sUrl
// load the file in the cWebIFrame object in the frame
WebSet psUrl of oFrame to sUrl
End_Procedure
End_object
Object oFrame is a cWebIFrame
End_Object
In the above example, the resource manager is used to generate a download URL for the file "c:\Catalog\Pricelist.pdf". The URL is sent back to the client by setting the psURL web property of a cWebIFrame object. Once the IFrame object receives the new psURL property value, it will automatically request this URL from the server. The server will invoke the resource manager to verify the session ID and stream the requested file.
If you need more control over your download parameters you can use CustomDownloadURL. DownloadURL calls CustomDownloadUrl.