|
<form asp-action="UploadFiles" enctype="multipart/form-data">
<ej-upload-box id="UploadDefault" width="100px" async-upload="false">
<e-button-text browse="File Browse" />
</ej-upload-box>
<input type="submit" />
</form> |
[HttpPost]
public IActionResult UploadFiles(IList<IFormFile> UploadDefault)
{
long size = 0;
foreach (var file in UploadDefault)
{
var filename = Path.GetFileName(UploadDefault[0].FileName);
filename = hostingEnv.WebRootPath + $@"\{filename}";
ViewBag.FileName = filename;
size += file.Length;
using (FileStream fs = System.IO.File.Create(filename))
{
file.CopyTo(fs);
fs.Flush();
}
}
return View("UploadFeatures");
} |