The following code is not working correctly. When Acrobat is triggered but instead of the file "outtest.fdf" being sent the php filename with fdf attached is sent.
For example: the code below is in the file pdf_pop.php, when the code executes the file pdf_pop.php.fdf is sent to Acrobat.
HELP!!!
php version 4.3.2, server IIS 5
header("Content-type: application/vnd.fdf");
$fp = fopen("../tmp/outtest.fdf", "r");
fpassthru($fp);
unlink("../tmp/outtest.fdf");
When I run this code by itself it works fine. However, when I include it in the rest of the file it produces the error above. The entire code is below.
Ned
$query2 = "select *
from xxx_setup
where num=$setup_id
";
$result2 = mysql_query($query2);
if (!$result2)
{
echo "There was a database error when executing <PRE>$sql</PRE>";
echo mysql_error();
exit;
}
$setup_results = mysql_num_rows($result2);
echo $setup_results;
for ($i=0; $i<$setup_results; $i++)
{
$row = mysql_fetch_array($result2);
$Driver = $row["driver"];
$Created = $row["created"];
$Track = $row["track"];
$Location = $row["location"];
$Surface = $row["surface"];
}
mysql_close();
// Populate the PDF File
$outfdf = fdf_create();
fdf_set_value($outfdf, "Driver", $Driver,0);
fdf_set_value($outfdf, "Created", $Created, 0);
fdf_set_value($outfdf, "Track", $Track, 0);
fdf_set_value($outfdf, "Location", $Location, 0);
fdf_set_value($outfdf, "Surface", $Surface, 0);
fdf_set_file($outfdf, "http://www.domain.com/test/pdf_file.pdf");
fdf_save($outfdf, "outtest.fdf");
fdf_close($outfdf);
header("Content-type: application/vnd.fdf");
//header ( "Content-Disposition: inline" );
$fp = fopen("outtest.fdf", "r");
fpassthru($fp);
unlink("outtest.fdf");
// End populate the PDF File
}