ADODB.Stream default filename wrong

T

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?
 
M

Mark J. McGinty

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
 
T

tedqn

Thanks, that didn't work but I found the solution -
Response.AddHeader "Content-disposition", "inline; filename=xxx"
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top