Sort of a limitation in flex, but created because of browser security. So
its not really a limitation of flex, but a limitation of the web in general.

What you are trying to do is very easy, though, so I wouldn't worry. If you
must send the file back and forth, you always can. 

In fact, its so simple I've made you an example (click the link to see it in
action):

http://groupnetwork.com/tools/echoDownload.php?filename=test.txt
<http://groupnetwork.com/tools/echoDownload.php?filename=test.txt&filedata=t
his%20is%20what%20goes%20in%20the%20txt%20file> &filedata=this is what goes
in the txt file

 

<?

if($_REQUEST['filename']=="" || $_REQUEST['filedata']=="") exit(); //no
filename or data specified

      

header("Content-Disposition: inline;
filename=\"".$_REQUEST['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( $_REQUEST['filedata'] ) + 1 ) );

header("Pragma: public");

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

echo $_REQUEST['filedata'];

exit();

 

?>

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of coder3
Sent: Thursday, January 31, 2008 6:39 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] how to create a file and then download

 


so basically i have to generate the file on server? 

currently my server returns an xml file via httpService. but i need a text
file for user to download. The best way is to create that (temp) text file
on my application and then download it. but sounds like it can't be done and
i have to call my server with the extra filtering parameters to make it
generate the text file.

isn't this one of the Flex limitations?

-c

Seth Caldwell-2 wrote:
> 
> You shouldn't have to save it on the server at all. You can return the
> data
> that was posted directly as a download. I would stray away from using a
> query string and use HTTP_POST instead.
> 
> Another thing you could do rather than send all the data to the server
> again
> would be to send parameters that specify what filtering the user did, and
> do
> that on the dataset on the server side, generate the file you want to have
> them download and send it.
> 
> 
> 
> Seth
> 
> 
> 
> 
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ]
On
> Behalf Of coder3
> Sent: Thursday, January 31, 2008 5:03 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: RE: [flexcoders] how to create a file and then download
> 
> 
> 
> 
> ok, if i send the data to the server, and server can generate it. for
> example,
> 
> my application is at http:/www.myapp.com/myapp, and i need to call
> "http://www.myserver.com/report.pl?myparameters"; so that it returns a text
> file, do i have to save it to the location where my application is and
> then
> download it?
> 
> thanks
> 
> -c
> 
> Tracy Spratt wrote:
>> 
>> Send the data to the server, generate the file there, pass back the
>> saved location, and download it.
>> 
>> Tracy
>> 
>> 
>> 
>> ________________________________
>> 
>> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com> ]
> On
>> Behalf Of coder3
>> Sent: Thursday, January 31, 2008 6:34 PM
>> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
<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-tp15217361p
>> 15217361.html
>> <http://www.nabble.com/how-to-create-a-file-and-then-download-tp15217361
>> p15217361.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
> 8596.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
9588.html
Sent from the FlexCoders mailing list archive at Nabble.com.

 

Reply via email to