foreach on Request.Files

https://stackoverflow.com/questions/1760510/foreach-on-request-files

The enumerator on the HttpFileCollection returns the keys (names) of the files, not the HttpPostedFileBase objects. Once you get the key, use the Item ([]) property with the key (filename) to get the HttpPostedFileBase object.

foreach (string fileName in Request.Files)
{
    HttpPostedFileBase file = Request.Files[fileName];

    ...
}
posted @ 2019-06-21 10:53  ChuckLu  阅读(308)  评论(0编辑  收藏  举报