print "Error: Incorrectly formatted file uploaded.<br />"; exit; } $filename = $_FILES['userfile']['tmp_name']; // create new queXMLPDF document $quexmlpdf = new queXMLPDF($_POST['orientation'], 'mm', $_POST['format'], true, 'UTF-8', false); set_time_limit(120); if (is_uploaded_file($_FILES['stylefile']['tmp_name'])) { $quexmlpdf->importStyleXML(file_get_contents($_FILES['stylefile']['tmp_name'])); } else { if ($_POST['eformat'] == "boxes") { $quexmlpdf->setCornerBoxes(); } $quexmlpdf->setStyle($_POST['style']); $quexmlpdf->setResponseTextFontSize($_POST['responseTextFontSize']); $quexmlpdf->setSectionHeight($_POST['sectionHeight']); $quexmlpdf->setBackgroundColourQuestion($_POST['backgroundColourQuestion']); $quexmlpdf->setBackgroundColourSection($_POST['backgroundColourSection']); $quexmlpdf->setSingleResponseAreaHeight($_POST['singleResponseAreaHeight']); $quexmlpdf->setSingleResponseHorizontalHeight($_POST['singleResponseHorizontalHeight']); $quexmlpdf->setQuestionnaireInfoMargin($_POST['questionnaireInfoMargin']); $quexmlpdf->setResponseLabelFontSize(array($_POST['responseLabelFontSize'], $_POST['responseLabelFontSizeSmall'])); } $quexmlpdf->create($quexmlpdf->createqueXML(file_get_contents($filename))); //NEED TO GET QID from $quexmlpdf $qid = intval($quexmlpdf->getQuestionnaireId()); $zip = new ZipArchive(); $filename = tempnam("/tmp", "queXMLPDF") . ".zip"; if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) { exit("cannot open temporary file\n"); }