public ActionResult UploadOnline(HttpPostedFileBase file) { try { if (file != null) { FTPUtilities.CreateFile(onlineDBFolder + file.FileName, file.InputStream); return(RedirectToAction("Index")); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } return(View()); }
public ActionResult PushToOnlineServer(string name) { try { string FilePathXML = HttpContext.Server.MapPath("~/App_Data/config.xml"); var doc = XDocument.Load(FilePathXML); string folderName = doc.Element("system.config").Element("path-backup").Value; if (folderName.Trim().Last() != '\\') { folderName += '\\'; } string filename = folderName + name; StreamReader r = new StreamReader(filename); FTPUtilities.CreateFile(onlineDBFolder + name, r.BaseStream); } catch { } return(RedirectToAction("Index")); }