From Blue Mars Developer Guidebook
This is a Web function.
- ARDownloadFile(url, destfile, options)
- start downloading a file from the specified URL, save with specified filename
- return value - true if a download is successfully started, false if not (missing parameters, another download in progress...)
- url - URL of remote file
- destfile - filename in which to save the download. This file will be located under the Blue Mars user folder.
- options - optional table of download parameters, which may contain the possible key-value pairs
These are the optional download parameters:
- agent - contents of the User-Agent header (used to identify the browser type). Defaults to "Blue Mars"
- referer - contents of the Referer header (used to identify the referring web site).
- cert - if true, verify server SSL certificate. Defaults to true.
- certfile - pathname of the certificate file used for SSL server authentication. Default is the ca-bundle.crt in the top-level Blue Mars directory.
- post - urlencoded post data
- redirect - number of redirects to follow. -1 specifies infinite redirects
- head - use HTTP HEAD method, which tells the server not to return content. Use if you just want to check GetDownloadFileTime without actually downloading the file.
- service - the network service to use (defaults to "AvatarReality")
- new - create a new downloader for this download
[Update] from release 12/16/2010 this function no longer sends referer by default.
- This function replaces Game.DownloadFile.
- Only one download can be in progress at a time. Check Game.IsDownloading before starting a new download.
- This function is named DownloadFile for historical reasons, as it was originally used for downloading maps and patches. It is just as valid for submitting information to a web server, using either POST or GET methods, but the content returned by the web server is always saved as a file (even, e.g. if it's the HTML displaying "404 Not Found".
- If new=true is specified, then that downloader instance can be referred to by specifying the "file" parameter in the other download functions.
- If new=true is specified, then remember to clean up the new downloader instance when you're done with it, using Game.RemoveDownload.
A simple example (just a GET request):
where url is any valid web URL
A POST request passing "firstname" and "lastname" parameters:
Download using an external downloader.
Create two new downloader objects and perform the downloads concurrently.
ARDownloadFile is used by some Web Utilities.