Пример #1
0
        public async Task <IActionResult> upload(List <IFormFile> upfile)
        {
            var result = new List <string>();

            bs.log("upload:" + upfile.Count);
            foreach (var f in upfile)
            {
                if (f.Length == 0)
                {
                    continue;
                }
                //한가득 정책(확장자검사, 용량검사..)
                var s = ContentDispositionHeaderValue.Parse(f.ContentDisposition).FileName.Trim();
                s = Guid.NewGuid() + "." + (new Regex("[\"]")).Replace(s, m => "").Split('.')[1];
                result.Add("/upfile/" + s);
                var st = new FileStream(bs.path(true, "upfile", s), FileMode.Create);
                await f.CopyToAsync(st);
            }
            return(Json(result));
        }