Parameter | Description |
---|---|
sPath | the local full path name of the file to be loaded to your client |
bAttachment | If True, the file will be streamed as an attachment; if False, inline. Streaming as attachment will show the 'save as' dialog. |
sDownloadFileName | Allows to send the file with a custom name instead of a default file name |
bBindSession | If True, the download URL will only work for the current session. If False, it requires a session, unless pbAllowNonSessionDownloads is True. |
iTimeout | Number of hours that the URL stays valid |
An encrypted URL that can be used by the client to download (and display) the file
Function CustomDownloadURL String sPath Boolean bAttachment String sDownloadFileName Boolean bBindSession Integer iTimeout Returns String
Call: | Get CustomDownloadURL sPath bAttachment sDownloadFileName bBindSession iTimeout to StringVariable |
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.