Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Downloading PDF Files
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Downloading PDF Files

 Post Reply Post Reply
Author
KenW View Drop Down
Newbie
Newbie
Avatar

Joined: 29 June 2004
Location: United Kingdom
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote KenW Quote  Post ReplyReply Direct Link To This Post Topic: Downloading PDF Files
    Posted: 11 August 2004 at 4:15pm

Hi

I hope someone can help me out on my site I have several files in PDF Fomat which open ok in the Adobe Reader using the following code

pdf_files/myfile.pdf

which works fine however I would like the users to be able to download the file. Can this be done without zipping the file?

Hope someone can help

Regards

Ken

Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 11 August 2004 at 4:40pm

How a browser handles a file type is entirely up to the end user. Some opt to automatically open it, some to automatically save it, and some to be presented a prompt asking what to do. This applies to all file types - pdf's, zips, whatever.

On my PC, I have eveything set up to ask for a prompt for every file type. Apparently on your PC, you have pdf's set up to automatically open. Don't assume that every user wants to handle a file the way you prefer.

The best you can so is to ask the user to right-click on a file link and select "save as" from the pop-up menu.


Lead me not into temptation... I know the short cut, follow me.
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 12 August 2004 at 12:14pm

After I posted the above, found this piece of code in a news group. Haven't tried it, and I think ADO has a limit of something like 2Mb, but it's worth a shot. Basically, it changes the http header going to the client.

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


Lead me not into temptation... I know the short cut, follow me.
Back to Top
KenW View Drop Down
Newbie
Newbie
Avatar

Joined: 29 June 2004
Location: United Kingdom
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote KenW Quote  Post ReplyReply Direct Link To This Post Posted: 12 August 2004 at 12:25pm

Thanks DP I will try it out

Regards

Ken

Back to Top
Bluefrog View Drop Down
Senior Member
Senior Member


Joined: 23 October 2002
Location: Korea, South
Status: Offline
Points: 1701
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bluefrog Quote  Post ReplyReply Direct Link To This Post Posted: 17 August 2004 at 9:15am
There might be another way to do that - try Googling for "force download asp". I've read a few things about it, but never needed it.
Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 17 August 2004 at 1:15pm
I have tried to find a solution to this, and the only thing I came up with was using ADODB.Stream.. but it was good enough for me.. don't think there's a limit on 2MB though..
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.