Add backload for multiple file upload
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Web.Mvc;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using LeafWeb.Web.ViewModels.LeafInput;
|
||||
|
||||
namespace LeafWeb.Web.Controllers
|
||||
@@ -7,13 +9,33 @@ namespace LeafWeb.Web.Controllers
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
// initialize the session storage to retain SessionID between requests
|
||||
Session["placeholder"] = 0;
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Index(CreateViewModel viewModel)
|
||||
{
|
||||
return View();
|
||||
// directory name is the sessionID
|
||||
var directory = Session.SessionID;
|
||||
var path = Path.Combine(Server.MapPath("~/Files/"), directory + "\\");
|
||||
var files = Directory.GetFiles(path);
|
||||
|
||||
if (!files.Any())
|
||||
{
|
||||
ModelState.AddModelError("", "Must select at least one file");
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// convert viewModel into Model
|
||||
|
||||
// load files into LeafInputFile
|
||||
|
||||
//
|
||||
}
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user