Hey guys.
<?php / $file = tempnam ("/tmp","PDF");/ ?>
<?php $file = "/tmp/temp.file" ?>
<?php $newPDF = exec("ps2pdf $userfile $file"); ?>
<?php $pdflength = filesize ($file); ?>
<?php
header ("HTTP/1.1 200 OK");
header ("Accept-Ranges: bytes");
header ("Content-Length: $pdflength");
header ("Content-Type: application/pdf");
?>
<?php $fd = fopen ($file, "r");
$contents = fread ($fd, $pdflength);
echo $contents; ?>
<?/ php $delete = unlink("$file");/ ?>
This PHP proggie takes a file upload from an HTML form; it's a postscript file. The idea is to create a temp file, convert the PS to PDF, and shoot the PDF back to the user, at which time their browser probably pops up adobe acrobat and displays the PDF.
This works fine. But you comment out line 2, and uncomment line 1, it stops working. Any idea why?