ASP download for PDF files not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Astra

    ASP download for PDF files not working

    Hi All

    The following ASP routine allows me to force a PDF file to download rather
    than show up in IE:

    Response.Conten tType = "applicatio n/asp-unknown" ' arbitrary

    Response.AddHea der "content-disposition","a ttachment; filename=" & theFile

    Set adoStream = Server.CreateOb ject("ADODB.Str eam")

    adoStream.Open( )

    adoStream.Type = 1

    adoStream.LoadF romFile(thePath )

    Response.Binary Write adoStream.Read( )

    adoStream.Close

    Set adoStream = Nothing

    Response.End

    This works fine for 250KB - 500KB PDF files, but I've just uploaded a 6MB
    file and it simply doesn't seem to do anything. The code does nothing which
    in turn means that the standard Save dialogue box can't find the file.

    Any ideas on what I can do?

    Rgds

    Robbie


  • Jeff Cochran

    #2
    Re: ASP download for PDF files not working

    On Fri, 23 Jul 2004 11:49:56 +0100, "Astra" <info@NoEmail.c om> wrote:
    [color=blue]
    >Hi All
    >
    >The following ASP routine allows me to force a PDF file to download rather
    >than show up in IE:
    >
    >Response.Conte ntType = "applicatio n/asp-unknown" ' arbitrary
    >
    >Response.AddHe ader "content-disposition","a ttachment; filename=" & theFile
    >
    >Set adoStream = Server.CreateOb ject("ADODB.Str eam")
    >
    >adoStream.Open ()
    >
    >adoStream.Ty pe = 1
    >
    >adoStream.Load FromFile(thePat h)
    >
    >Response.Binar yWrite adoStream.Read( )
    >
    >adoStream.Clos e
    >
    >Set adoStream = Nothing
    >
    >Response.End
    >
    >This works fine for 250KB - 500KB PDF files, but I've just uploaded a 6MB
    >file and it simply doesn't seem to do anything. The code does nothing which
    >in turn means that the standard Save dialogue box can't find the file.
    >
    >Any ideas on what I can do?[/color]

    How do you know it does nothing?

    Jeff

    Comment

    • Laphan

      #3
      Re: ASP download for PDF files not working

      Hi Jeff

      Sorry for the delay in coming back to you.

      Basically I know it isn't reading the file in properly, because when the
      download is trying to initiate I can see that it doesn't know what the
      filename is and therefore says that it can't find the path.

      It can't be a fault of the code, because the exact same code works if the
      file is smaller.

      Rgds

      Laphan


      Jeff Cochran <jeff.nospam@zi na.com> wrote in message
      news:4101300a.1 90786686@msnews .microsoft.com. ..
      On Fri, 23 Jul 2004 11:49:56 +0100, "Astra" <info@NoEmail.c om> wrote:
      [color=blue]
      >Hi All
      >
      >The following ASP routine allows me to force a PDF file to download rather
      >than show up in IE:
      >
      >Response.Conte ntType = "applicatio n/asp-unknown" ' arbitrary
      >
      >Response.AddHe ader "content-disposition","a ttachment; filename=" & theFile
      >
      >Set adoStream = Server.CreateOb ject("ADODB.Str eam")
      >
      >adoStream.Open ()
      >
      >adoStream.Ty pe = 1
      >
      >adoStream.Load FromFile(thePat h)
      >
      >Response.Binar yWrite adoStream.Read( )
      >
      >adoStream.Clos e
      >
      >Set adoStream = Nothing
      >
      >Response.End
      >
      >This works fine for 250KB - 500KB PDF files, but I've just uploaded a 6MB
      >file and it simply doesn't seem to do anything. The code does nothing which
      >in turn means that the standard Save dialogue box can't find the file.
      >
      >Any ideas on what I can do?[/color]

      How do you know it does nothing?

      Jeff


      Comment

      Working...