I am uploading a file into a controller using the following -
[HttpPost]
public ActionResult Index(HttpPostedFileBase file)
{
if (file.ContentLength > 0)
{
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
//I want to put file contents into a string or List<string>
}
}
I would like to either put the contents of the file into a string then loop through the string which will be a delimited list,
or
loop through the incoming stream itself, creating a list of strings out of it.
I can't figure out how to do either. I assume I would use file.InputStream in some manner?
Any help would be appreciated. Thanks!
System.IO.File.ReadAllText? Or maybe i'm not getting it