Are you using PHP on the server side?
You will use HTTP Service and post to a server script which will then cause
a download to happen.
Sample PHP echo service for file download:
<?
if($_POST['filename']=="" || $_POST['filedata']=="") exit(); //no filename
or data specified
header("Content-Disposition: inline; filename=\"".$_POST['filename']."\"");
header("Content-Type: application/octet-stream");
header("Content-Type: application/force-download");
header("Content-Type: application/download");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".( strlen( $_POST['filedata'] ) + 1 ) );
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
echo $_POST['filedata'];
exit();
?>
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of coder3
Sent: Thursday, January 31, 2008 4:08 PM
To: [email protected]
Subject: RE: [flexcoders] how to create a file and then download
this part is quite simple. i use the httpService to get the data and display
it to mx:Grid, which can be changed based on some filtering info.
now i need to download the filtered data list. so how can i simulate a
download?
thanks Seth.
-c
Seth Caldwell-2 wrote:
>
> Since flash player can't write to their hard drive you have to simulate a
> download, or actually perform an upload of your data to the server, and
> then
> a download of it.
>
> I know some people who have made an echo service - basically you post
> filename "somefile.txt" and filedata "this is the data you wrote to this
> file" and the server simply gives you a download with that filename and
> data.
>
> I could give you some code if I know your back end environment.
>
>
>
> Seth
>
>
>
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> ]
On
> Behalf Of coder3
> Sent: Thursday, January 31, 2008 3:34 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] how to create a file and then download
>
>
>
>
> Hi,
> I need to generate a file based on the current data on the page and then
> download it. help?
>
> the sample code i can find is to download an existing file from the same
> directory as the SWF document.
>
> thanks!
>
> c
> --
> View this message in context:
>
http://www.nabble.com/how-to-create-a-file-and-then-download-tp15217361p1521
> 7361.html
> Sent from the FlexCoders mailing list archive at Nabble.com.
>
>
>
>
>
--
View this message in context:
http://www.nabble.com/how-to-create-a-file-and-then-download-tp15217361p1521
7894.html
Sent from the FlexCoders mailing list archive at Nabble.com.