How to read fileupload into a string

A

ad

I put a fileupload in my web application to let user upload a text file.
I want to use a string variable to receive the file which user upload.
I do the steps below.

How can I read the content of the file form fileupload ?
 
K

Kevin Spencer

The HttpRequest.Files Collection is a Collection of HttpPostedFile classes.
The HttpPostedFile class represents a stream, which is exposed via the
InputStream property. Use a StreamReader class to read the stream into a
string.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top