Create a real tmp file for resulting PDF

This commit is contained in:
7u83 2020-03-06 10:02:02 +00:00
parent b14dc2762c
commit 47aa9982c0

View file

@ -300,18 +300,21 @@ foreach ($_POST['description'] as $key => $val) {
} }
//var_dump($pdfs); //var_dump($pdfs);
//
$resultnam = tempnam("/tmp","karesult");
$cmd = "$CONVERT_CMD"; $cmd = "$CONVERT_CMD";
foreach ($pdfs as $filename){ foreach ($pdfs as $filename){
$cmd .= " $filename"; $cmd .= " $filename";
} }
$cmd .= " cat output /tmp/result.pdf"; $cmd .= " cat output $resultnam.pdf";
exec ($cmd); exec ($cmd);
//var_dump($_POST); //var_dump($_POST);
#echo "CMD: $cmd<br>"; #echo "CMD: $cmd<br>";
#die; #die;
$file = "/tmp/result.pdf"; $file = "$resultnam.pdf";
header('Content-Disposition: attachment; filename="'. basename($file) . '"'); header('Content-Disposition: attachment; filename="'. basename($file) . '"');
header('Content-Length: ' . filesize($file)); header('Content-Length: ' . filesize($file));
readfile($file); readfile($file);