Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string FTPHost = "ftp://xxx.xxx.xxx/myfile.json";
- public string FTPUserName = "loginFTP";
- public string FTPPassword = "passFTP";
- public void ImportJSON () {
- Directory.CreateDirectory(Path.Combine(Application.persistentDataPath, "Backups"));
- Debug.Log("On créé le dossier Backup");
- var FilePath = Path.Combine(Application.persistentDataPath, "Backups");
- using (WebClient request = new WebClient())
- {
- request.Credentials = new NetworkCredential(FTPUserName, FTPPassword);
- byte[] fileData = request.DownloadData(FTPHost);
- Debug.Log ("OK GO On sauvegarde le fichier dans Backups");
- using (FileStream file = File.Create(FilePath))
- {
- file.Write(fileData, 0, fileData.Length);
- file.Close();
- }
- Debug.Log("Download Complete");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement