Home All Groups Group Topic Archive Search About

ADODB.Stream default filename wrong



Author
14 Dec 2005 12:40 AM
tedqn
I use the Stream method to serve certain file types to the user. If the
type is pdf, it opens in the browser fine. My problem is with those
that the browser doesn't have plug-ins such as ppt, word, etc. it
prompts to choose Open/Save/Cancel and defaults the filename to the ASP
page serving the content. ie. BinarySend.asp -> BinarySend.doc,
BinarySend.ppt.

If I use
Response.AddHeader "content-disposition", "attachment;filename=" &
sFileName then it defaults the filename to the name I specify but
always prompt a download instead of opening directly.

Is there another way to default the filename in situation like this?

Author
14 Dec 2005 3:33 AM
Mark J. McGinty
<te***@yahoo.com> wrote in message
Show quote
news:1134520849.937178.4500@g47g2000cwa.googlegroups.com...
>I use the Stream method to serve certain file types to the user. If the
> type is pdf, it opens in the browser fine. My problem is with those
> that the browser doesn't have plug-ins such as ppt, word, etc. it
> prompts to choose Open/Save/Cancel and defaults the filename to the ASP
> page serving the content. ie. BinarySend.asp -> BinarySend.doc,
> BinarySend.ppt.
>
> If I use
> Response.AddHeader "content-disposition", "attachment;filename=" &
> sFileName then it defaults the filename to the name I specify but
> always prompt a download instead of opening directly.
>
> Is there another way to default the filename in situation like this?

Are you setting the content type too?  e.g.,

    Response.AddHeader "Content-type", "application/vnd.ms-word;
name='WORD'"

I believe that will make it do what you want.  Of course, that means your
code must know what that content type is for any given file.


-Mark
Author
14 Dec 2005 11:01 PM
tedqn
Thanks, that didn't work but I found the solution -
Response.AddHeader "Content-disposition", "inline; filename=xxx"

AddThis Social Bookmark Button