Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ExportZIP() {
- string FTPHost = "ftp://xxxx";
- string FTPUserName = "xxxx";
- string FTPPassword = "xxxx";
- string FilePath;
- if (Application.internetReachability == NetworkReachability.NotReachable) {
- Debug.Log ("Error. Check internet connection!");
- } else {
- try {
- FilePath = Application.persistentDataPath+"/test.zip";
- Debug.Log ("Path: " + FilePath);
- WebClient client = new System.Net.WebClient ();
- Uri uri = new Uri (FTPHost + new FileInfo (FilePath).Name);
- Debug.Log (uri);
- client.UploadProgressChanged += new UploadProgressChangedEventHandler (OnFileUploadProgressChanged);
- client.UploadFileCompleted += new UploadFileCompletedEventHandler (OnFileUploadCompleted);
- client.Credentials = new System.Net.NetworkCredential (FTPUserName, FTPPassword);
- client.UploadFileAsync (uri, "STOR", FilePath);
- } catch {
- Debug.Log ("error");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement