DIsplay uploaded file

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top