AlivePDF download and save to server


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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. ?>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.