Created
June 21, 2010 16:35
-
-
Save jarrettmeyer/447112 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Get all HTTP POSTed Files that were uploaded as part of a | |
/// multipart form POST. This abstraction keeps the controller | |
/// from dealing with the Request object directly. | |
/// </summary> | |
public IEnumerable<HttpPostedFileBase> HttpPostedFiles | |
{ | |
get | |
{ | |
// _httpContext has been pre-assigned to be the current HttpContextBase | |
// object running on the server. | |
return _httpContext.Request.Files.Cast<string>() | |
.Select(httpFile => _httpContext.Request.Files[httpFile]) | |
.Where(postedFile => postedFile.ContentLength > 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment