コード例 #1
0
        public IActionResult UploadFiles(List <IFormFile> files)
        {
            if (!files.Any())
            {
                return(RedirectToAction("Files"));
            }
            foreach (IFormFile file in files)
            {
                string newFileName = _fileLogic.AddFile(new StoredFileDTO
                {
                    UserId     = _accountLogic.GetCurentUserById(),
                    FileName   = file.FileName,
                    FileSize   = _shareControllerHelper.FormatSize(file.Length),
                    UploadDate = DateTime.Now
                });


                _fileLogic.UploadFileOnDiskAsync(_uploads, file, newFileName);
            }
            return(RedirectToAction("Files"));
        }