I use DropzoneJS with MVC. The file uploads fine, but action will not display another view, neither will display another view after redirected to another action. Just stays on the same view it was called from.
Action :
[HttpPost]
public ActionResult FileUpload(HttpPostedFileBase file)
{
if(file != null)
{
string ext = Path.GetExtension(file.FileName);
if (file.ContentLength > 0 && ext == ".txt")
{
var fileName = Path.GetFileName(file.FileName);
if (fileName != null)
{
var path = Path.Combine(Server.MapPath("~/uploads"), fileName);
file.SaveAs(path);
}
}
}
return View("Report");
// This will redirect to action but will not display another view either:
// return RedirectToAction("Report");
}
View called from:
<div id="dropzone">
<form action="/Dashboard/FileUpload" class="dropzone clickable" id="demo-upload" method="post" enctype="multipart/form-data">
</form>
</div>