Question

I have an HttpPostedFile object and just need to extract the content of the posted file.

I found this link but that's a very long process to just obtain a string with the content.

Is there any shorter way? (Preferably, a one line instruction.)

Était-ce utile?

La solution

var str = new StreamReader(postedFile.InputStream).ReadToEnd();

StreamReader.ReadToEnd

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top