CustomDownloadURL - cWebResourceManager
A lower level version of DownLoadURL. Use to generates a more customized 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 |
| bAttachment | Boolean | If True, the file will be streamed as an attachment; if False, inline. Streaming as attachment will show the 'save as' dialog. |
| sDownloadFileName | String | Allows to send the file with a custom name instead of a default file name |
| bBindSession | Boolean | If True, the download URL will only work for the current session. If False, it requires a session, unless pbAllowNonSessionDownloads is True. |
| iTimeout | Integer | Number of hours that the URL stays valid |
Syntax
Function CustomDownloadURL String sPath Boolean bAttachment String sDownloadFileName Boolean bBindSession Integer iTimeout Returns String
Call Example
Get CustomDownloadURL sPath bAttachment sDownloadFileName bBindSession iTimeout to StringVariable
Description
CustomDownloadURL allows you to generate a unique and secure URL with the ability to apply special options, such as: invoking the Save As dialog at the client, changing the file name at the client, allowing the URL to be used with any client session ID, setting a timeout for the URL.
The following example demonstrates how to download a file and invoke the Save As dialog to save it on the client.
Object oButton is a cWebButton
Set psCaption to "Save Prices"
Procedure Ok
String sPath sUrl
Move "c:\Catalog\Pricelist.pdf" to sPath
// Builds an encrypted URL based on the file path
Get CustomDownloadURL of ghoWebResourceManager sPath True "" True 0 to sUrl
// load the file in the cWebIFrame object in the frame
Send NavigateToPage to ghoWebApp sUrl btNewWindow
End_Procedure
End_Object
You can usually use DownloadURL, along with pbDownloadBindSession and piDownloadTimeout, to handle most downloads.
See Also
Return Value
An encrypted URL that can be used by the client to download (and display) the file