Jump to content

Flash builder -> PHP (with POSTvars) -> download generated document PROBLEM


Recommended Posts

Hi there,

 

In short :

i am running a php-script with (post)vars send from  flash builder using a HTTPService.  This script creates a document which is automatically downloaded to the client... 

As long as i used GETvars to open a webpage to the php-script everyting works.  But with POSTvars, it fails...

 

The php-code that generates the document wasn't changed :

        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 when i use POSTvars, it still creates a good document, but the download doesn't work.

 

In the .mxml (Flash builder) 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);

}

 

Any hints on what i am doing wrong?

Thanks in advance

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.