ES3Cloud.UploadFile
public static IEnumerator UploadFile(string filePath, string user, string password, ES3Settings settings)
public static IEnumerator UploadFile(ES3File file, string user, string password)
Description
Uploads a local file to the server, overwriting any existing file stored on the server for the given user.
Note that all parameters are optional.
If no filePath parameter is provided, it will attempt to upload the default file.
If no user parameter is provided, the file will be global to all users.
For more information, see the Uploading and Downloading Files using ES3Cloud guide.
Parameters
[table th=”0″]filePath,”[Optional] The relative or absolute path of the local file we want to upload to the server.”
user,”[Optional] The name of the user this file belongs to, if we don’t want the file to be global.”
password,”[Optional] The password of the user this file belongs to.”
settings,”[Optional] The settings we want to use to override the default settings.”
es3File,”[Optional] Specify this to upload an ES3File instead of a file from storage.”[/table]
Examples
C#
// Create a new ES3Cloud object with the URL to our ES3.php file. var cloud = new ES3Cloud("https://www.myserver.com/ES3Cloud.php", "myAPIKey"); // Upload a local file with the cloud for a particular user. yield return StartCoroutine(cloud.UploadFile("myFile.es3", "myUser", "myUsersPassword")); if(cloud.isError) Debug.LogError(cloud.error); // Upload another local file, but make it global for all users. yield return StartCoroutine(cloud.UploadFile("myGlobalFile.es3")); if(cloud.isError) Debug.LogError(cloud.error);
JS
// Create a new ES3Cloud object with the URL to our ES3.php file. var cloud = new ES3Cloud("https://www.myserver.com/ES3Cloud.php", "myAPIKey"); // Upload a local file with the cloud for a particular user. yield cloud.UploadFile("myFile.es3", "myUser", "myUsersPassword"); if(cloud.isError) Debug.LogError(cloud.error); // Upload another local file, but make it global for all users. yield cloud.UploadFile("myGlobalFile.es3"); if(cloud.isError) Debug.LogError(cloud.error);