示例#1
0
 public ActionResult Show()
 {
     string host = Request["host"];
     string user = Request["user"];
     string password = Request["password"];
     string path = Request["path"];
     string action = Request["action"];
     Utility ftp = new Utility(host, user, password);
     if (action == "Listar")
         List(ftp, path);
     else if (action == "Upload")
         Upload(ftp, path);
     else if (action == "Rename")
         Rename(ftp, path);
     else if (action == "Delete")
         Delete(ftp, path);
     return View();
 }
示例#2
0
 private void Upload(Utility ftp, string path)
 {
     string destinationPath = Server.MapPath("~/Content/TextFile1.txt");
     ftp.UploadFile(path, destinationPath);
 }
示例#3
0
 private void Rename(Utility ftp, string path)
 {
     ftp.RenameFile(path, "TextFile1.txt", "TextFile2.txt");
 }
示例#4
0
 private void List(Utility ftp, string path)
 {
     ViewBag.List = ftp.GetFiles(path);
 }
示例#5
0
 private void Delete(Utility ftp, string path)
 {
     ftp.DeleteFile(path, "TextFile2.txt");
 }