Re: [PHP] helping people...

2006-06-21 Thread Matthew Pegg

Subject: Re: [PHP] helping people...



No that wasnt a ddos threat you idiot, i dont play them games.
And when you keep sending spam is when it starts to piss people off.



Rob W: Seriously mate, you are way... way outa line here.

I've only used this list once and all I can say is...thank god people in 
general
want to go out of their way to help others out.  That's how lists like this 
get started
and how lists like these foster and grow and I'd like to thank the people 
who
pointed ME in the right direction..and hopefully I can at some point return 
the favour.


I read back through your posts, and all I could think was - here's some 
dimwit
undergrad with a PHP assignment due in on Monday, who hasn't done anything 
to

help himself because THE INTERNET is just, like, you know - right there !!

This may or may not be you, but certainly that's the impression I got.

Do the participants on this list a favour - when you do finally hand that 
puppy in a coupla
days late - let the list know what mark they got and what percentage of the 
overall mark

it counted for...

(PS.  I have some old C exam and prac tests on floppies that you can have 
for 20 bucks..and
a paper on Mosaic and the World Wide Web circa 1993 that I'd be happy to 
throw in for free..
oh... and a copy of Bill Gates - The Road Ahead... you can have that too... 
I'm not using it anymore ;-)


cheers,
Matt.

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



[PHP] PHP/Mysql: Making binary field available for download - extra browser window ?

2006-06-02 Thread Matthew Pegg
Hi all,

Working on a PHP script at the moment where I want to be able to
extract a file (PDF file) from a mysql database and force the popup
of the File Download dialog, to allow the user to either save or open
the document (ie. and bypass loading the file using the browser's plugin) 

I've found solutions on the net for doing this with a file using readfile()
but if I can get away with it, I don't want to create temporary files...

Here's what I've got so far (truncated...):
?
..
// db query string extract the PDF file
$result = mysql_query(select file_data from brochure where 
id=1,$connection);

$row= mysql_fetch_array($result);
$lengths = mysql_fetch_lengths($result);

// Grab the file contents as returned from the db
$pdf_brochure = $row[file_data];

// setup headers to force download of $pdf_brochure into crap.pdf
header(Pragma: public);
header(Expires: 0);
header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
header(Cache-Control: private,false); // required for certain browsers
header(Content-Type: application/force-download);

header(Content-Disposition: attachment; filename=\crap.pdf\; );
header(Content-Transfer-Encoding: binary);
header(Content-Length:  . $lengths[0]);

// send the file to stdout
print $pdf_brochure;//  problem might be here 
exit();

?

This almost works but the problem is that this code still spawns a new empty
browser window, and I don't know how to prevent this Can anyone help ?


regards,
Matt.

-- 
___
Matt Pegg
IT Specialist
Abacus Business Machines
Ballarat, Australia.
___