DIsplay uploaded file

G

Guest

I am developing file management application in VB.NET . I am trying to display the uploaded document in the browser . I permit files with extension .txt , .doc .gif .jpg . if it is a .txt file i use streamreader to display its contents in the browser but if the document type is .doc then it displays all messy text when I use streamreader . How can i display the .doc & image document in browser .Even if the formatting is not good thtas fine as long as all the text is correct shape

Any help

Thanks
 
S

Sherif ElMetainy

Hello

Don't use a stream reader. Use
Response.WriteFile(filename)

then set the content type property of the response.
Response.ContentType = "application/msword" for doc files
Response.ContentType = "image/gif" for gif files,
Response.ContentType = "text/plain" for txt files, etc

Best regards,
Sherif

Ken said:
I am developing file management application in VB.NET . I am trying to
display the uploaded document in the browser . I permit files with extension
..txt , .doc .gif .jpg . if it is a .txt file i use streamreader to display
its contents in the browser but if the document type is .doc then it
displays all messy text when I use streamreader . How can i display the .doc
& image document in browser .Even if the formatting is not good thtas fine
as long as all the text is correct shape.
 

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

Top