I've got a button that has this code:
var myDoc = event.target;
myDoc.submitForm({
cURL: "http://myserver/submitpdf.php#PDF",
cSubmitAs: "PDF",
cPermID: myDoc.docID[0],
cInstID: myDoc.docID[1],
cUsageRights: submitFormUsageRights.RMA
});
and this PHP written on the server (this script writes to a simple text log what it's getting and when whenever a request is made to submitpdf.php):
<?php
foreach($_REQUEST as $k => $v) {
$postarray .= $k . "=" . $v . "&";
}
foreach($_FILES as $h => $z) {
$postarray .= $h . "=" . $z . "&";
}
$data = "time: " . date("d/m/y : H:i:s", time()) . " | PostedVariables=" . $postarray . "\n";
$file = "log.txt";
if (!$file_handle = fopen($file,"a")) { echo "Cannot open file"; }
if (!fwrite($file_handle, $data)) { echo "Cannot write to file"; }
fclose($file_handle);
?>
When I run it cSubmitAs FDF - I see in the log a POSTed variable called topmostSubform=Array& which represents the data. So, it works.
However, when I submit as PDF I don't get anything in GET, POST or FILES. I'm quite perplexed. Any ideas?
Thanks in advance for your help.
Jason
$fp = fopen( 'pdf/jason.pdf', 'wb' );
fwrite( $fp, $GLOBALS[ 'HTTP_RAW_POST_DATA' ] );
fclose( $fp );
This saves the PDF to the server. However, it only works in Professional. Reader is giving me trouble. Progress, though. Progress.