Return to Snippet

Revision: 55898
at February 27, 2012 22:34 by vamapaull


Initial Code
<?php
//This project is done by vamapaull: http://vamapaull.com

if(isset($GLOBALS["HTTP_RAW_POST_DATA"])){
	$pdf = $GLOBALS["HTTP_RAW_POST_DATA"];
	$name = $_GET["name"];
	$save_to = "pdf/". $name;
	file_put_contents($save_to, $pdf);
	
	// add headers for download dialog-box
	header('Content-Type: application/pdf');
	header('Content-Length: '.strlen($pdf));
	header('Content-disposition:'.$method.'; filename="'.$name.'"');
	echo $pdf;
	
} else{
	echo "Encoded PDF information not received.";
}
?>

Initial URL
http://blog.vamapaull.com/alivepdf-download-and-save-to-server/

Initial Description
This PHP code is made to help people using the ActionScript 3 AlivePDF library to save PDF files from a Flash app to a server.

ActionScript 3 AlivePDF save code:
_pdf.save(Method.REMOTE, "save.php", Download.ATTACHMENT, "MyFile.pdf");

Initial Title
AlivePDF download and save to server

Initial Tags
php, actionscript, server, download, convert, 3

Initial Language
PHP