Hi all,
I have a download for that collects data from a user (name, e-mail etc) 
then I pass that info to a database and give them the file.
In the form, I pass two hidden variables, header and details_captured.
So when I post the form to $PHP_SELF, it detects this and then activates 
the header code, and hopefully gives the file to the user.
The $bu variable and others are from the previous form too.

So, it works great on my desktop here at work, but I just got a few mails 
from random users, who complained that they saw an error screen after 
trying to download pdf's.
Dunno if this is a PDF problem, or if my script is bad?

So, here is my code... (that site at the very top of my page.)
The headers after the else statement are simply to avoid page caching, so 
we can ignore them in this example.....
So, why does this work for me and many others, but not all?

============================

if (($header == 'collect') && ($details_captured == "yes")) {
        session_start();
        $path = "/home/site/download/$bu/$file";
    header("Content-Disposition: attachment; filename=$file");
    header("Content-Length: " . filesize($path));
    header("Content-Type: " . filetype($path));
    readfile("$path");
} else {
        session_start();
        Header("Cache-control: private, no-cache"); 
        Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); # Past date
        Header("Pragma: no-cache");
}


=============================

*********************************************************************
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***********************************************************************

Reply via email to