Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



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

Posts: 133
Location: kalamazoo
Trades: 0
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!
 
 
Register now for full access!
Old 05-02-2008, 02:30 PM Re: allow download of files from website.
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 504
Name: Nick Ohrn
Trades: 0
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");
?>
__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-03-2008, 12:47 AM Re: allow download of files from website.
matt w's Avatar
Super Talker

Posts: 133
Location: kalamazoo
Trades: 0
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, 02:02 PM Re: allow download of files from website.
addonchat's Avatar
Super Talker

Posts: 115
Name: Chris Duerr
Trades: 0
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

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
addonchat is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to allow download of files from website.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 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.94049 seconds with 12 queries