WebFile.ForceDownload

From Xojo Documentation
Jump to: navigation, search
Property (As Boolean)
aWebFile.ForceDownload = newBooleanValue
or
BooleanValue = aWebFile.ForceDownload

Indicates whether the browser will always download the file instead of trying to display it (depending on the MIMEType). The default is False.


Notes

When True, the browser will always download the file rather than try to display it. For example, most web browsers will try to display simple text files and many will display PDF files inline. Set ForceDownload to True to instead ensure these types of files are downloaded instead.


Example

Create a new file for downloading:

TextFile = New WebFile // TextFile is a property of the web page
TextFile.MimeType = "text/plain"
TextFile.ForceDownload = True // If False, the browser may try to display the file instead of download it
TextFile.FileName = "TextFile.txt"

TextFile.Data = "Hello, world!"

ShowURL(TextFile.URL) // This causes the file to be downloaded
Personal tools
Namespaces

Variants
Actions
Main
Documentation
Community
Toolbox
Help