public IActionResult Upload() { if (!MultipartRequestHelper .IsMultipartContentType(Request.ContentType)) { return(BadRequest()); } var defaultFormOptions = new FormOptions(); var bondary = MultipartRequestHelper .GetBoundary(MediaTypeHeaderValue.Parse(Request.ContentType), defaultFormOptions.MultipartBoundaryLengthLimit); var reader = new MultipartReader(bondary, HttpContext.Request.Body); var addedFiles = new List <FileModel>(); foreach (var section in reader.ReadFileContent()) { var fileName = MultipartRequestHelper .ParseFileName(section.ContentDisposition); try { var addedFile = storage.Add(fileName, section.Body); addedFiles.Add(addedFile); } catch (ArgumentException) { return(BadRequest()); } } return(Json(addedFiles)); }