Reply
allow download of files from website.
Old 05-02-2008, 12:59 PM allow download of files from website.
matt w's Avatar
Experienced Talker

Posts: 35
Location: kalamazoo
I want people to view PowerPoint presentations (in read only format in .pdf), then if they like them, the fill out a small form and get permission to download the real thing in .ppxt. Do I simply link to a .pptx file in my public_ftp folder and then it automatically downloads to their PC? Or how?

matt w.
matt w is offline
Reply With Quote
View Public Profile Visit matt w's homepage!
 
Sponsored Links (We share ad revenue):
 
Old 05-02-2008, 01:30 PM Re: allow download of files from website.
nickohrn's Avatar
Weightlifting CS Student

Posts: 451
Name: Nick Ohrn
I wouldn't suggest linking directly to a publicly accessible file. If you do that, people you don't want to have access to the file might get access to it. What I would do is place the PPT file outside of your web root and read it in after verifying they were referred after filling in the form. Make sure you send the appropriate header from the page.

PHP Code:
<?php
header
("Content-type: application/powerpoint");   
echo 
file_get_contents("../somefile.pptx");
?>
__________________
NickOhrn.com - My personal haven of insight to offer the world.
Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
nickohrn is offline
Reply With Quote
View Public Profile Visit nickohrn's homepage!
 
Old 05-02-2008, 11:47 PM Re: allow download of files from website.
matt w's Avatar
Experienced Talker

Posts: 35
Location: kalamazoo
If you will forgive a newbie mistake, where exactly is outside my web root directory?
matt w is offline
Reply With Quote
View Public Profile Visit matt w's homepage!
 
Old 05-04-2008, 01:02 PM Re: allow download of files from website.
addonchat's Avatar
Skilled Talker

Posts: 97
Name: Chris Duerr
Anywhere. If you have a folder called 'public_html' or 'www'.. just make sure it's not within that folder. Your ftp folder is probably fine. Alternatively, you could just create a folder in your standard public_html folder and place an .htaccess file in it to restrict access. (http://httpd.apache.org/docs/1.3/howto/htaccess.html for your reference)

Use Nick's code to allow users to view the file -- you'll have to figure out authentication though first if it matters, which I assume it does

Also, if you want to force a download screen:
PHP Code:
header('Content-Length: $size_of_file');
header('Content-Disposition: attachment;filename="$filename.pdf"'); 
__________________
Chris Duerr
AddonChat Java Chat Software
http://www.addonchat.com/ - Affiliate Program
addonchat is offline
Reply With Quote
View Public Profile
 
Sponsored Links (We share ad revenue):
 
Reply     « Reply to allow download of files from website.
 

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML


Page generated in 0.14591 seconds with 14 queries