1 Reply Latest reply on Jul 5, 2012 1:24 AM by FLexOuhammi

    Flash builder + PHP (Post) + download a file

    dzjoepken

      Hi there,

      i had a form in flash builder that sends variables in GET to a php-script. This script generates a document dat is downloaded to the client by the following php-code :

       

              header('Content-Description: File Transfer');

              header("Content-type: text/csv");

              header('Content-Length: ' . filesize($file));

              header('Content-Disposition: attachment; filename=' . basename($file));

              readfile($file);

       

      Now i wanted to change my flashbuilder-file so it sends the file to php by POST-vars.  It still generates the correct file, but it isn't downloaded to the client (i use the same code as above).  Can anybody give me a hint on what i'm doing wrong?

       

      The code that i'm using for sending my params to php :

       

      In the mxml i have :

      <fx:Declarations>

              <fx:String id="phpFile">./amfphp/services/persdb/rapport_post.php</fx:String>

              <mx:HTTPService id="form1"

                              url="{phpFile}"

                              method="POST"

                              result="handleResult(event)"

                              fault="handleFault(event)"

                              resultFormat="text">

                  <mx:request>

                      <type>tmp</type>

                      <rapport>tmp</rapport>

                      <params>tmp</params>

                  </mx:request> </mx:HTTPService>

          </fx:Declarations>

       

      And my .as file contains this :

      public function sendCsvForm():void{

          var param:Object = new Object;

          param.type = "Persoon.Rapport";

          param.rapport = "CSVCode";

          param.params =  query3 + "~" + filterQuery + "~csvbestand";

          form1.send(param);

      }

       

      Thanks in advance for having a look on it

      Dzjoepken