readfile(...);
runs fclose() from inside the readfile function.
I have
function write_pdf()
{
$fp = fopen("/tmp/test.pdf?, "w");
...
// do pdf stuff...
...
fclose($fp);
}
function read_pdf();
{
header("Content-type: application/pdf");
readfile("/tmp/test.pdf");
}
I wanted the functions seperate so that I could have a script write a pdf and not view it. have a script view the pdf without writing to it. or have a script write & view the pdf.
but for some reason I guess I cant do this. its strange that fclose() doesnt accually close the file until the script finnishes, it just que's the file to be closed I guess.
and strange that if the file is opened "r" I can close it then open it and view it. but "w" or "w+" I can't do that.
Chris Lee