Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:21 PM
Astra
Guest
 
Posts: n/a
Default 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.ContentType = "application/asp-unknown" ' arbitrary

Response.AddHeader "content-disposition","attachment; filename=" & theFile

Set adoStream = Server.CreateObject("ADODB.Stream")

adoStream.Open()

adoStream.Type = 1

adoStream.LoadFromFile(thePath)

Response.BinaryWrite 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


  #2  
Old July 19th, 2005, 02:21 PM
Jeff Cochran
Guest
 
Posts: n/a
Default Re: ASP download for PDF files not working

On Fri, 23 Jul 2004 11:49:56 +0100, "Astra" <info@NoEmail.com> 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.ContentType = "application/asp-unknown" ' arbitrary
>
>Response.AddHeader "content-disposition","attachment; filename=" & theFile
>
>Set adoStream = Server.CreateObject("ADODB.Stream")
>
>adoStream.Open()
>
>adoStream.Type = 1
>
>adoStream.LoadFromFile(thePath)
>
>Response.BinaryWrite 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?[/color]

How do you know it does nothing?

Jeff
  #3  
Old July 19th, 2005, 02:28 PM
Laphan
Guest
 
Posts: n/a
Default 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@zina.com> wrote in message
news:4101300a.190786686@msnews.microsoft.com...
On Fri, 23 Jul 2004 11:49:56 +0100, "Astra" <info@NoEmail.com> 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.ContentType = "application/asp-unknown" ' arbitrary
>
>Response.AddHeader "content-disposition","attachment; filename=" & theFile
>
>Set adoStream = Server.CreateObject("ADODB.Stream")
>
>adoStream.Open()
>
>adoStream.Type = 1
>
>adoStream.LoadFromFile(thePath)
>
>Response.BinaryWrite 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?[/color]

How do you know it does nothing?

Jeff


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles