File Uploading in Scaffolded Page
Blooming Developer
276
Reputation points
Hi
In my Scaffolded Create Page i have a option for file upload.
I want to show this uploaded file in my edit page.
In my create page, im creating a folder with name as record ID and the file will be saved into this folder.
var foldername = NoticeBoard.ID.ToString();
var DirectoryPath = Path.Combine(_env.WebRootPath, "AdminDocs", foldername);
if (!System.IO.Directory.Exists(DirectoryPath))
{
System.IO.Directory.CreateDirectory(DirectoryPath);
}
if (UploadFile != null)
{
var filesave = Path.Combine(_env.WebRootPath, "AdminDocs", NoticeBoard.ID.ToString(), "Doc-" + NoticeBoard.NoticeName + "_" + UploadFile.FileName);
using (var stream = System.IO.File.Create(filesave))
{
await UploadFile.CopyToAsync(stream);
}
}
I want to show this uploaded file in Edit Page and Details page with link to open in another tab.
Sign in to answer