ES2Web.Download
Returns
IEnumerator | The IEnumerator for the coroutine. |
Description
Downloads our data from the URL specified when creating the ES2Web object.
C#
A coroutine which downloads all data stored in myFile.txt on the server
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
public IEnumerator DownloadEntireFile() { // As we don't specify a tag, it will download everything // within the file 'myFile.txt'. string myURL = "https://www.server.com/ES2.php?webfilename=myFile.txt"; ES2Web web = new ES2Web(myURL); // Start downloading our data and wait for it to finish. yield return StartCoroutine(web.Download()); if(web.isError) { // Enter your own code to handle errors here. Debug.LogError(web.errorCode + ":" + web.error); } // Now save our data to file so we can use ES2.Load to load it. web.SaveToFile("myFile.txt"); } |
JS
A coroutine which downloads all data stored in myFile.txt on the server
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
function DownloadEntireFile() { // As we don't specify a tag, it will download everything // within the file 'myFile.txt'. var myURL = "https://www.server.com/ES2.php?webfilename=myFile.txt"; var web = new ES2Web(myURL); // Start downloading our data and wait for it to finish. yield StartCoroutine(web.Download()); if(web.isError) { // Enter your own code to handle errors here. Debug.LogError(web.errorCode + ":" + web.error); } // Now save our data to file so we can use ES2.Load to load it. web.SaveToFile("myFile.txt"); } |