Groups | Blog | Home
all groups > asp.net > march 2004 >

asp.net : DIsplay uploaded file


Ken
3/28/2004 10:56:06 PM
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

Sherif ElMetainy
3/29/2004 2:01:22 PM
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

[quoted text, click to view]
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.
[quoted text, click to view]

AddThis Social Bookmark Button