On Wed, 29 May 2002, Ron Stagg wrote:

> Is this even possible within the open realm of the browser?  Have any of
> you solved a similar problem?  I welcome any ideas.

Your solution is pretty easy.  Assign a php script that will actually 
send the download.  At this point, your PHP script can do whatever 
integrity checking you need for you to be satisfied payment occurred.  
Then all you need to do is send a couple of headers and stream the file 
directly to the end user.

I'd suggest headers like this:

<?PHP

/* 

I'll assume you do authentication and whatnot up here.  Errors, 
warnings, redirects, whatever... all go up here.  When you're
satisfied, move on to the stuff below.  Make sure no other headers
have been sent by this point.

*/

header("Content-type: application/zip");
header("Content-Disposition: filename=\"the_file_name_you_want.zip\"");

// At this point, you may either construct, or stream whatever data
// you want.  Just make sure it matches your declared Content-type.

readfile("any_file_you_want.zip");

?>

And done.

If you put the file you send somewhere out of the document root, the 
download location can't even be reverse-engineered.  This script is the 
only way to get that file.

-- 
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Shaun M. Thomas                INN Database Administrator           |
| Phone: (309) 743-0812          Fax  : (309) 743-0830                |
| Email: [EMAIL PROTECTED]    AIM  : trifthen                      |
| Web  : www.townnews.com                                             |
|                                                                     |
|     "Most of our lives are about proving something, either to       |
|      ourselves or to someone else."                                 |
|                                           -- Anonymous              |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to