Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public IHttpActionResult PostFiles()
- {
- HttpFileCollection httpFileCollection = HttpContext.Current.Request.Files;
- var streams = new List<Stream>();
- var countAddedStream = 0;
- foreach (var formDataKey in httpFileCollection.AllKeys)
- {
- var httpPostedFile = httpFileCollection[formDataKey];
- if (httpPostedFile != null)
- streams.Add(httpPostedFile.InputStream);
- if (++countAddedStream == 5)
- break;
- }
- // Fail
- if (countAddedStream < 3)
- return BadRequest("Не достаточно корректных файлов для создания отчета");
- // Success
- //...
- return Ok();
- }
Add Comment
Please, Sign In to add comment