Downloadable Pdf file

This is a discussion on "Downloadable Pdf file" within the Web Page Design section. This forum, and the thread "Downloadable Pdf file are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Nov 24th, 2006, 08:31
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Downloadable Pdf file

I have a pdf file that id like to allow people to download from my website.

Problem is i've never done this before, can anyone give me a brief run down of how to go about it?

Thanks guys
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Nov 24th, 2006, 08:45
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

Dont worry chaps.

I was googleing for the wrong search term and came up with nothing, hence the above query.

I got it now.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Nov 24th, 2006, 12:12
Reputable Member
Join Date: Jul 2006
Location: Baldock
Age: 20
Posts: 465
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

Hi i no you have it now but for most beginners out there this is how you do it ok <a href="filenmame.pdf">Name of File</a> Depends on the extension if could be .exe .rar .zip .txt and so on please enjoy the experience
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Nov 24th, 2006, 19:49
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

Thanks for that aaron , i have a nasty habit of forgeting to provide the answers to my own questions when i finally figure it out lol.

Cheers mate, much appreciated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Nov 24th, 2006, 19:56
Reputable Member
Join Date: Jul 2006
Location: Baldock
Age: 20
Posts: 465
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

no problem mate jsut thought if there was a beginner to check this out then they would know what to do and there life would be much easier but if theres anything else you wanna know pm

Thanx
Aaron
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Nov 25th, 2006, 01:03
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

Just for reference, this is a handy little PHP script that forces a download rather than opening the file in a user's browser window:

PHP: Select all

<?php

$f 
fopen("file/to/be/downloaded.pdf""rb");
$content_len = (int) filesize("file/to/be/downloaded.pdf");
$content_file fread($f$content_len);
fclose($f);

$output_file 'info.pdf'// The filename you want the downloader to see

@ob_end_clean();
@
ini_set('zlib.output_compression''Off');
header('Pragma: public');

header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header('Cache-Control: private');
header('Content-Transfer-Encoding: none');
header('Content-Type: application/octetstream; name="'.$output_file.'"');
header('Content-Type: application/octet-stream; name="'.$output_file.'"');
header('Content-Disposition: inline; filename="'.$output_file.'"');
header("Content-length: $content_len");

echo 
$content_file;
exit();

?>
It's come in useful for me a number of times
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Nov 25th, 2006, 01:06
Reputable Member
Join Date: Jul 2006
Location: Baldock
Age: 20
Posts: 465
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

Hey Ryan mate can you use this for a Downloadable buy now button so when people click the buy now button they pay for it but they get an email with the link to the download the stuff i am selling

Thanx
Aaron
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Nov 25th, 2006, 01:20
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

No. This just forces a browser to download a file. For instance, if you linked to a .html file, the browser would open it up like a page, but if you linked to this script, and this script had paths to an html file, the browser would actually download it to the user's desktop.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Nov 25th, 2006, 01:23
Reputable Member
Join Date: Jul 2006
Location: Baldock
Age: 20
Posts: 465
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

Ok. But did you understand what i mean cause thats what i am trying to solve in php mate is get something i have a buy now button and then when people click it they pay for the item but then they get an email with the link to the download the item as everysingle item i am sellnig will be home made 3d models with 3ds max and stuff so was wodnering if you could help me out on this
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Nov 25th, 2006, 11:32
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

Okay, you read as bad as you write. I understand now.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Nov 25th, 2006, 13:46
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

Ryan, from what you saying, and correct me if im wrong, that nifty littkle script could have some pretty unpleasant applications if it was used by the wrong person.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Nov 25th, 2006, 23:36
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

You know, I haven't thought of it before. But I just tested and it's not capable of downloading PHP files. I'm not good enough in this area of PHP to tell you whether it can be changed, but it seems like there's some type of safeguard here.

You can force download files on remote servers with the following function taken from http://php.net/

PHP: Select all

function remote_filesize($uri,$user='',$pw='') {
    
ob_start();
    
$ch curl_init($uri);
    
curl_setopt($chCURLOPT_HEADER1);
    
curl_setopt($chCURLOPT_NOBODY1);
    if(!empty(
$user) && !empty($pw)) {
        
$headers = array('Authorization: Basic '.base64_encode($user.':'.$pw));  
        
curl_setopt($chCURLOPT_HTTPHEADER$headers);
    }
    
$okay curl_exec($ch);
    
curl_close($ch);
    
$head ob_get_contents();
    
ob_end_clean();
    
$regex '/Content-Length:\s([0-9].+?)\s/';
    
$count preg_match($regex$head$matches);
    if(isset(
$matches[1]))
        
$size $matches[1];
    else
        
$size 'unknown';
    return 
$size;

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Nov 26th, 2006, 04:10
Reputable Member
Join Date: Jul 2006
Location: Baldock
Age: 20
Posts: 465
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

ok mate maybe i try that then but i have some 1 making me the script i want for £15 hes going to use paypal for it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Nov 30th, 2006, 15:09
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: Downloadable Pdf file

I personally just have PDF files open in safari itself of course you could always right click on the link and press option to get Save target to change to save target as..
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Dec 2nd, 2006, 22:41
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

Yeah, Safari has such a nice implementation of a PDF viewer. That's right PC users! Another Mac thing that's better!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old Dec 2nd, 2006, 22:41
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Downloadable Pdf file

Oh I forgot... Macs are PC's now.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
pdf

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Downloadable newsletter? AdRock Webforumz Cafe 9 Oct 13th, 2007 01:00
making pdfs downloadable gribble Web Page Design 5 Sep 14th, 2007 22:02
Help with Downloadable document fallregatta Starting Out 2 Jun 11th, 2007 12:46
Making some hyperlinks that are none downloadable/right-clickable acrobat Web Page Design 14 May 6th, 2007 06:46
How to add downloadable files to my site (such as eBooks) alisonf1972 PHP Forum 2 Mar 11th, 2005 13:57


All times are GMT. The time now is 08:10.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved