> From: jeff Hughes [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 15, 2003 6:31 PM
>  a user uploads a word doc to the database via the web. another use
should
> be able to go in and request that document. I get the doc back as a
byte
> array and push into a memoryStream I can write the file to disk but
how do
> I just take the stream convert it to a doc and allow the user to
download
> it?

// set content type and disposition 
// attachment will force Open/Save dialog
// otherwise document may be loaded in browser frame
Response.ContentType = "application/msword";
Response.AddHeader("content-disposition", 
                      "attachment;filename=" + filename);

// if downloading from file
Response.WriteFile(filepath);

// if downloading from byte array
Response.BinaryWrite(bytes);

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to