• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Flash builder + PHP (Post) + download a file

New Here ,
May 23, 2012 May 23, 2012

Copy link to clipboard

Copied

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

TOPICS
PHP

Views

1.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 05, 2012 Jul 05, 2012

Copy link to clipboard

Copied

LATEST

Hi,

It s will be nice to change your url string to something like http:// So that you invoque executing your php script instead of reading its content.

All in all, just change:

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

with this:

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines