Posted By

vamapaull on 02/27/12


Tagged

php actionscript server download pdf save to convert 3 as3 alivepdf Alive HTTPRAWPOSTDATA


Versions (?)

AlivePDF download and save to server


 / Published in: PHP
 

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

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");

  1. <?php
  2. //This project is done by vamapaull: http://vamapaull.com
  3.  
  4. if(isset($GLOBALS["HTTP_RAW_POST_DATA"])){
  5. $pdf = $GLOBALS["HTTP_RAW_POST_DATA"];
  6. $name = $_GET["name"];
  7. $save_to = "pdf/". $name;
  8. file_put_contents($save_to, $pdf);
  9.  
  10. // add headers for download dialog-box
  11. header('Content-Type: application/pdf');
  12. header('Content-Length: '.strlen($pdf));
  13. header('Content-disposition:'.$method.'; filename="'.$name.'"');
  14. echo $pdf;
  15.  
  16. } else{
  17. echo "Encoded PDF information not received.";
  18. }
  19. ?>

Report this snippet  

You need to login to post a comment.