ADODB.Stream default filename wrong

Discussion in 'ASP General' started by tedqn@yahoo.com, Dec 14, 2005.

  1. Guest

    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?
     
    , Dec 14, 2005
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    >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
     
    Mark J. McGinty, Dec 14, 2005
    #2
    1. Advertising

  3. Guest

    Thanks, that didn't work but I found the solution -
    Response.AddHeader "Content-disposition", "inline; filename=xxx"
     
    , Dec 14, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hawksey
    Replies:
    3
    Views:
    1,013
    Mark Rae
    Nov 30, 2006
  2. bb2j3z
    Replies:
    1
    Views:
    5,402
    Alexey Smirnov
    Dec 12, 2008
  3. Andrew Durstewitz

    Server.CreateObject("ADODB.Stream")

    Andrew Durstewitz, Jul 3, 2003, in forum: ASP General
    Replies:
    0
    Views:
    210
    Andrew Durstewitz
    Jul 3, 2003
  4. Robert Brown
    Replies:
    7
    Views:
    244
    Robert Brown
    Dec 4, 2003
  5. Bill
    Replies:
    0
    Views:
    409
Loading...

Share This Page