public string Generate(string ModGUID) { RServiceClient client = new RServiceClient(); client.AddRq(ModGUID); MyLog.writeLog("执行"); return("success"); }
/// <summary> /// 上传文件 /// </summary> /// <returns></returns> public JsonResult UpLoadFile() { HttpPostedFileBase file = Request.Files[0]; string strModGUID = Request.QueryString["ModGUID"]; string dirPath = HttpContext.Server.MapPath("/Uploads/" + strModGUID + "/"); try { if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } else { DirectoryInfo di = new DirectoryInfo(dirPath); FileInfo[] fis = di.GetFiles(); foreach (FileInfo fi in fis) { fi.Delete(); } } string filePath = Path.Combine(dirPath, file.FileName); file.SaveAs(filePath); StreamReader st = new StreamReader(filePath, Encoding.GetEncoding("UTF-8")); RServiceClient client = new RServiceClient(); client.saveFile(strModGUID + Path.GetExtension(file.FileName), st.ReadToEnd()); st.Dispose(); st.Close(); } catch (Exception e) { MyLog.writeLog("ERROR", e); } //foreach (HttpPostedFileBase file in FilesInput) //{ // string filePath = Path.Combine(HttpContext.Server.MapPath("/Uploads/"), Path.GetExtension(file.FileName)); // file.SaveAs(filePath); //} return(Json(new { })); }