コード例 #1
0
        public async Task <IActionResult> Index(PersoneFormFile formFile)
        {
            IFormFile file = formFile.MioFormFile;

            if (file == null || file.Length == 0)
            {
                return(BadRequest());
            }

            Image img = null;

            using (var memoryStream = new MemoryStream())
            {
                await file.CopyToAsync(memoryStream);

                using (img = Image.FromStream(memoryStream))
                {
                    //img.Save( MyServer.MapPath("wwwroot/images/Elenco1.png") );
                    img.Save(MyServer.MapPath("wwwroot/images/" + file.FileName));
                }
            }


            //var persone = new PersoneCSV( formFile );
            //return View("ListPersone", persone);

            return(View(new PersoneFormFile()));
        }