Hi team
I need some help, i have created file-upload the idea i want to display a table, that will have 'FileName', 'DateCreated', 'DateModified', 'ModifiedBy', 'Size'. Image below is an example. This is what i have done so far
-
- [HttpGet]
- public ActionResult FileIndex()
- {
- RegCoursesViewModel model = new RegCoursesViewModel();
-
- return View(model);
- }
-
- [HttpPost]
- public ActionResult FileIndex(HttpPostedFileBase files)
- {
-
- if(files !=null && files.ContentLength > 0)
- {
-
- var fileName = Path.GetFileName(files.FileName);
-
-
- var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
- files.SaveAs(path);
- }
- return RedirectToAction("FileIndex");
- }
- public class eNtsaFileUpload
- {
- [Key]
- public int? Id { get; set; }
- public string FileName { get; set; }
- public DateTime DateCreated { get; set; }
- public DateTime DateModified { get; set; }
- public string Modified_By { get; set; }
- public byte[] Size { get; set; }
- public string FileUrl { get; set; }
- public IEnumerable<eNtsaFileUpload> FileList { get; set; }
- }
- <center>
- @using (Html.BeginForm("FileIndex", "Home", FormMethod.Post))
- {
- <div class="form-horizontal">
- <div class="form-group row">
- <div class="col-xs-3 ml-auto">
- <label class="custom-file-upload">
- <i class="fa fa-stack"></i>Upload
- <input type="file" />
- </label>
- </div>
- </div>
- </div>
- }
- </center>