Advertisement
Guest User

Untitled

a guest
Apr 14th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public void ExportZIP() {
  2.  
  3. string FTPHost = "ftp://xxxx";
  4. string FTPUserName = "xxxx";
  5. string FTPPassword = "xxxx";
  6. string FilePath;
  7.  
  8. if (Application.internetReachability == NetworkReachability.NotReachable) {
  9. Debug.Log ("Error. Check internet connection!");
  10. } else {
  11. try {
  12. FilePath = Application.persistentDataPath+"/test.zip";
  13. Debug.Log ("Path: " + FilePath);
  14.  
  15. WebClient client = new System.Net.WebClient ();
  16. Uri uri = new Uri (FTPHost + new FileInfo (FilePath).Name);
  17.  
  18. Debug.Log (uri);
  19. client.UploadProgressChanged += new UploadProgressChangedEventHandler (OnFileUploadProgressChanged);
  20. client.UploadFileCompleted += new UploadFileCompletedEventHandler (OnFileUploadCompleted);
  21. client.Credentials = new System.Net.NetworkCredential (FTPUserName, FTPPassword);
  22. client.UploadFileAsync (uri, "STOR", FilePath);
  23.  
  24. } catch {
  25. Debug.Log ("error");
  26. }
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement