Hello,
where can I find the controller code for ASP.NET Core Upload Asynchronous Upload. Somehow when I trying to upload my file, I keep getting an error "failed to upload the file". below is what i have in my controller:
public ActionResult Async_Save(IEnumerable<IFormFile> files)
{
// The Name of the Upload component is "files"
string path = Path.Combine(_webHostEnvironment.WebRootPath, "FileSavePath");
string DestinationPath = _configuration["DestinationPath"].ToString();
if (files != null)
{
MoveFiles mf = new MoveFiles();
foreach (var formFile in files)
{
using (var stream = System.IO.File.Create(DestinationPath))
{
formFile.CopyTo(stream);
}
}
}
This is my cshtml code:
any help will be apprecaited.
@using Kendo.Mvc.UI
<div style="margin-top:60px">
<div class="block-section">
@(Html.Kendo().Upload()
.Name("files")
.Async(a => a
.Save("Async_Save", "Upload")
.Remove("Async_Remove", "Upload")
.AutoUpload(true)
)
)
</div>
</div>