Guest User

Untitled

a guest
Jan 16th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. public IHttpActionResult PostFiles()
  2. {
  3. HttpFileCollection httpFileCollection = HttpContext.Current.Request.Files;
  4.  
  5. var streams = new List<Stream>();
  6.  
  7. var countAddedStream = 0;
  8. foreach (var formDataKey in httpFileCollection.AllKeys)
  9. {
  10. var httpPostedFile = httpFileCollection[formDataKey];
  11. if (httpPostedFile != null)
  12. streams.Add(httpPostedFile.InputStream);
  13. if (++countAddedStream == 5)
  14. break;
  15. }
  16.  
  17. // Fail
  18. if (countAddedStream < 3)
  19. return BadRequest("Не достаточно корректных файлов для создания отчета");
  20. // Success
  21. //...
  22. return Ok();
  23. }
Add Comment
Please, Sign In to add comment