public ActionResult Action(string mode, string path, string name, bool?showThumbs) { FileManager mgr = new FileManager() { Name = name, Path = path, Operation = (FileManagerOperations)Enum.Parse(typeof(FileManagerOperations), mode), PreviewPath = Url.Action("Preview", "FileManager") }; if (mgr.Operation == FileManagerOperations.download) { return this.Image(System.Web.HttpContext.Current.Server.MapPath(path)); } return Json(mgr.GetResult(), JsonRequestBehavior.AllowGet); var obj = new { Path="/Resources/Galleries/CIMG0422.JPG", FileName = "abc.jpg", FileType="jpg", Preview="/Resources/Galleries/CIMG0422.JPG", Properties = new { Height= 14, Width= 14, Size=300 }, Error="", Code=0 }; return Json(obj, JsonRequestBehavior.AllowGet); }
public ActionResult Action(string mode, string currentpath, string upload, FormCollection form) { HttpPostedFileBase newfile = (HttpPostedFileBase)Request.Files["newfile"]; FileManager mgr = new FileManager() { Name = newfile.FileName, Path = currentpath, File = newfile, Operation = (FileManagerOperations)Enum.Parse(typeof(FileManagerOperations), mode) }; JavaScriptSerializer sr = new JavaScriptSerializer(); return Content(sr.Serialize(mgr.GetResult())); return Json(mgr.GetResult(), JsonRequestBehavior.AllowGet); }