ES2Web.UploadRaw
Upload Raw String
public IEnumerator UploadRaw(string data)
Parameters
[table th=”0″]data,”The raw string to upload. Must be on the Supported Types list.[/table]
Returns
[table th=”0″]IEnumerator,”The IEnumerator for the coroutine.”[/table]
Description
Uploads our raw string to the URL specified when creating the ES2Web object without any header data. The string will be uploaded in UTF-8 encoding.
Note: When saving using UploadRaw, you can only access that data using ES2Web.LoadRaw() or by accessing the database directly.
C#
A coroutine to Upload a raw string to the server with a given tag
public IEnumerator UploadRawString(string myString, string tag)
{
string myURL = "https://www.server.com/ES2.php?webfilename=myFile.txt";
ES2Web web = new ES2Web(myURL + "&tag=" + tag);
// Start uploading our data and wait for it to finish.
yield return StartCoroutine(web.UploadRaw(myString));
if(web.isError)
{
// Enter your own code to handle errors here.
// For a list of error codes, see www.moodkie.com/easysave/ES2Web.ErrorCodes.php
Debug.LogError(web.errorCode + ":" + web.error);
}
}
JS
A coroutine to Upload a raw string to the server with a given tag
function UploadRawString(myString : String, tag : String)
{
var myURL = "https://www.server.com/ES2.php?webfilename=myFile.txt";
var web = new ES2Web(myURL + "&tag=" + tag);
// Start uploading our data and wait for it to finish.
yield StartCoroutine(web.UploadRaw(myString));
if(web.isError)
{
// Enter your own code to handle errors here.
// For a list of error codes, see www.moodkie.com/easysave/ES2Web.ErrorCodes.php
Debug.LogError(web.errorCode + ":" + web.error);
}
}
Upload Raw Bytes
public IEnumerator UploadRaw(byte[] data)
Parameters
[table th=”0″]data,”The raw bytes to upload. Must be on the Supported Types list.[/table]
Returns
[table th=”0″]IEnumerator,”The IEnumerator for the coroutine.”[/table]
Description
Uploads our raw data to the URL specified when creating the ES2Web object without any header data.
Note: When saving using UploadRaw, you can only access that data using ES2Web.LoadRaw() or by accessing the database directly.
C#
A coroutine to Upload raw bytes to the server with a given tag
public IEnumerator UploadRawBytes(byte[] myBytes, string tag)
{
string myURL = "https://www.server.com/ES2.php?webfilename=myFile.txt";
ES2Web web = new ES2Web(myURL + "&tag=" + tag);
// Start uploading our data and wait for it to finish.
yield return StartCoroutine(web.UploadRaw(myBytes));
if(web.isError)
{
// Enter your own code to handle errors here.
// For a list of error codes, see www.moodkie.com/easysave/ES2Web.ErrorCodes.php
Debug.LogError(web.errorCode + ":" + web.error);
}
}
JS
A coroutine to Upload raw bytes to the server with a given tag
function UploadRawString(myBytes : byte[], tag : String)
{
var myURL = "https://www.server.com/ES2.php?webfilename=myFile.txt";
var web = new ES2Web(myURL + "&tag=" + tag);
// Start uploading our data and wait for it to finish.
yield StartCoroutine(web.UploadRaw(myBytes));
if(web.isError)
{
// Enter your own code to handle errors here.
// For a list of error codes, see www.moodkie.com/easysave/ES2Web.ErrorCodes.php
Debug.LogError(web.errorCode + ":" + web.error);
}
}