Retrieving a binary file from a database and naminig the downloaded file explicitly

Discussion in 'ASP .Net' started by James Cooke, Aug 15, 2003.

  1. James Cooke

    James Cooke Guest

    I succesfull yam able to download binary data by calling a page called
    BinaryData.aspx. BinaryData.aspx gets the binary data from the database,
    and displays it as such:

    Response.Buffer = True
    Response.ClearContent()
    Response.ClearHeaders()
    Response.ContentType = binaryFieldType
    Response.BinaryWrite(binaryField)
    Response.End()

    This then produces a download called

    BinaryData.ZIP, or
    BinaryData.MDB or
    BinaryData.PDF
    with the file extension differing depending on what the ContentType is.

    My question: I want to be able to change the *root* name of the download to
    something else - for example
    MyData.ZIP, or
    Customers.MDB or
    Document1.PDF

    How? Am I using the wrong approach in extracting this binary data, and if
    so, where do I start looking?
    thanks in advance
     
    James Cooke, Aug 15, 2003
    #1
    1. Advertising

  2. James Cooke

    James Cooke Guest

    you are a star! thanks for the rapid response Steve!
    "Steve C. Orr, MCSD" <> wrote in message
    news:%...
    > You need to add this line of code:
    > Response.AddHeader("Content-Disposition","attachment;filename=" &
    > strFileName)
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD
    > http://Steve.Orr.net
    > Developer for Hire
    >
    >
    > "James Cooke" <> wrote in message
    > news:...
    > > I succesfull yam able to download binary data by calling a page called
    > > BinaryData.aspx. BinaryData.aspx gets the binary data from the

    database,
    > > and displays it as such:
    > >
    > > Response.Buffer = True
    > > Response.ClearContent()
    > > Response.ClearHeaders()
    > > Response.ContentType = binaryFieldType
    > > Response.BinaryWrite(binaryField)
    > > Response.End()
    > >
    > > This then produces a download called
    > >
    > > BinaryData.ZIP, or
    > > BinaryData.MDB or
    > > BinaryData.PDF
    > > with the file extension differing depending on what the ContentType is.
    > >
    > > My question: I want to be able to change the *root* name of the download

    > to
    > > something else - for example
    > > MyData.ZIP, or
    > > Customers.MDB or
    > > Document1.PDF
    > >
    > > How? Am I using the wrong approach in extracting this binary data, and

    if
    > > so, where do I start looking?
    > > thanks in advance
    > >
    > >
    > >
    > >

    >
    >
     
    James Cooke, Aug 15, 2003
    #2
    1. Advertising

  3. Steve is a big STAR I vote for him

    "James Cooke" <> wrote in message
    news:...
    > you are a star! thanks for the rapid response Steve!
    > "Steve C. Orr, MCSD" <> wrote in message
    > news:%...
    > > You need to add this line of code:
    > > Response.AddHeader("Content-Disposition","attachment;filename=" &
    > > strFileName)
    > >
    > > --
    > > I hope this helps,
    > > Steve C. Orr, MCSD
    > > http://Steve.Orr.net
    > > Developer for Hire
    > >
    > >
    > > "James Cooke" <> wrote in message
    > > news:...
    > > > I succesfull yam able to download binary data by calling a page called
    > > > BinaryData.aspx. BinaryData.aspx gets the binary data from the

    > database,
    > > > and displays it as such:
    > > >
    > > > Response.Buffer = True
    > > > Response.ClearContent()
    > > > Response.ClearHeaders()
    > > > Response.ContentType = binaryFieldType
    > > > Response.BinaryWrite(binaryField)
    > > > Response.End()
    > > >
    > > > This then produces a download called
    > > >
    > > > BinaryData.ZIP, or
    > > > BinaryData.MDB or
    > > > BinaryData.PDF
    > > > with the file extension differing depending on what the ContentType

    is.
    > > >
    > > > My question: I want to be able to change the *root* name of the

    download
    > > to
    > > > something else - for example
    > > > MyData.ZIP, or
    > > > Customers.MDB or
    > > > Document1.PDF
    > > >
    > > > How? Am I using the wrong approach in extracting this binary data, and

    > if
    > > > so, where do I start looking?
    > > > thanks in advance
    > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    MS News \(MS ILM\), Aug 15, 2003
    #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. ntm

    downloaded file is missing

    ntm, Jan 21, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    378
  2. ProJee
    Replies:
    0
    Views:
    886
    ProJee
    Jul 21, 2004
  3. George
    Replies:
    8
    Views:
    2,416
    Devdex Developer
    Sep 1, 2004
  4. Christopher D. Wiederspan

    Saving Downloaded Xml from ASPX page as File

    Christopher D. Wiederspan, Sep 9, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    391
    Christopher D. Wiederspan
    Sep 9, 2004
  5. Brett  Kelly
    Replies:
    1
    Views:
    721
    Steve C. Orr [MVP, MCSD]
    Jun 16, 2006
Loading...

Share This Page