public ActionResult attachUpload(string customName) { var allSTUnit = GetCurrentInstsST(); var customids = allSTUnit.Where(r => r.Value == customName).Select(r => r.Key).ToList(); string customid = string.Empty; if (customids != null && customids.Count > 0) { customid = customids.First(); } string realname = Request.Files["file"].FileName; var extensionName = System.IO.Path.GetExtension(realname); string filename = "/{0}/{1}{2}".Fmt(customid, Guid.NewGuid().ToString().Replace("-", ""), extensionName); fileHander.UploadFile(Request.Files["file"].InputStream, "userfiles", filename); DhtmlxUploaderResult uploader = new DhtmlxUploaderResult() { state = true, name = filename }; string str = uploader.ToJson(); return(Content(str)); }
public async Task <ActionResult> attachUpload(string name) { //string customid = checkUnitService.GetCheckUnitByName(customName); string realname = Request.Files["file"].FileName; var extensionName = System.IO.Path.GetExtension(realname); string filename = "/{0}/{1}{2}".Fmt(name, Guid.NewGuid().ToString().Replace("-", ""), extensionName); fileHander.UploadFile(Request.Files["file"].InputStream, "userfiles", filename); DhtmlxUploaderResult uploader = new DhtmlxUploaderResult() { state = true, name = filename }; string str = uploader.ToJson(); return(Content(str)); }