* Thus wrote Scott Taylor:
> 
> It opened Adobe, then an
> Adobe Reader window opened that stated "There was an error opening this
> document.  This file cannot be found."
> 
> So that must mean that the streamfile($file) function (see below) did not 
> return false, otherwise the message would have been "file was not found.  
> please send [EMAIL PROTECTED]"
> 
> Does someone know what's going on here?  Since I am not experincing this 
> problem first handed, I really have no clue.  Also, shouldn't this person 
> get prompted if he wants to save it or open it with Adobe Acrobat?

For the first part, basically, IE thinks it shouldn't cache the
file so by the time adobe gets it there isn't a file for it to use.

As for the second question, you have absolutly no control on what
application will open with what ever mime type is sent.  I've seen
people that had their browser set to try and execute html documents :)

To fix your problem add this before you start your session:

session_cache_limiter('private'); /* more below... */
> 
> session_name("miningstocks_subscribers");
> session_set_cookie_params(TIMEOUT_SUBSCRIBERS);
> session_start();
> 
> ...
> 
>            header("Content-Type: " . $type);
>            header("Accept-Ranges: bytes");

Becareful sending this header.  The client can get confused and
send special headers requesting a partial file, while also
expecting different results than the whole file.

>            header("Content-Length: ".filesize($file));
>            header("Content-Disposition: attachment; 
> filename=".basename($file).";");           
>            //readfile($file);   
>            $fp = fopen($file, 'rb');
>            $buffer = fread($fp, filesize($file));

You'll be much better off if you use fpassthru here. This fread
could kill you're machine's memory.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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

Reply via email to