public ActionResult Index(int id, UploadFile model)//idmaster { if (!ModelState.IsValid) { return View(model); } byte[] uploadFile = new byte[model.File.InputStream.Length]; model.File.InputStream.Read(uploadFile, 0, uploadFile.Length); string fileFolder = Server.MapPath("~/Files"); if (!Directory.Exists(fileFolder)) { Directory.CreateDirectory(fileFolder); } string folderMaster = id.ToString().PadLeft(10, '0'); string folder = Server.MapPath("~/Files/" + folderMaster); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string file = Path.Combine(folder, Guid.NewGuid().ToString() + "." + Path.GetExtension(model.File.FileName)); System.IO.File.WriteAllBytes(file, uploadFile); return Content("File Uploaded."); }
public ActionResult Download(int id) { FASTrack.ViewModel.UploadFile file = new UploadFile(); file.Id = id; return View(file); }
public ActionResult Index(int id)//idmaster { var model = new UploadFile(); model.Id = id; return View(model); }