예제 #1
0
        public async Task <IActionResult> Upload(IFormFile formFile)
        {
            var fileName = WebUtility.HtmlEncode(Path.GetFileName(formFile.FileName));

            var memoryStream = new MemoryStream();

            formFile.CopyTo(memoryStream);
            memoryStream.Seek(0, SeekOrigin.Begin);
            var binaryReader = new BinaryReader(memoryStream);
            var bytes        = binaryReader.ReadBytes((int)memoryStream.Length);
            var newBlock     = _chainService.CreateNextBlock(bytes, fileName);

            _networkManager.BroadcastNewBlock(newBlock);
            return(RedirectToAction("Index"));
        }