-2

I want to be able to use the code block below, but instead of using a saved file I have an uploaded file as a HttpPostedFileBase. How to I convert that to an equivalent format where I can use the contents of the uploaded file with the code below without saving it first?

  List<DailyValues> values = File.ReadAllLines("C:\\Users\\Josh\\Sample.csv")
                                               .Skip(1)
                                               .Select(v => DailyValues.FromCsv(v))
                                               .ToList();
PixelPaul
  • 2,357
  • 4
  • 31
  • 53
  • 1
    Possible duplicate of [ASP.Net MVC - Read File from HttpPostedFileBase without save](http://stackoverflow.com/questions/16030034/asp-net-mvc-read-file-from-httppostedfilebase-without-save) – Evan Trimboli Dec 15 '16 at 02:26

1 Answers1

0

You can't. The best way is to read the data as a Stream from the InputStream property on that object.

John K
  • 601
  • 5
  • 9