Write data to file

I know this has been asked but I’m not finding a direct, simple answer to my question in the archives.

Very simply: In AS3, can I write data to a file? I have composed a quiz and I need to get a user’s result out of the .swf and into a file.

If this can’t be done, why not?

If so, what’s the simplest way?

I know there is a way to do it using PHP, but I have no PHP experience, so if that’s the answer, I would appreciate a link or a file that illustrates.

Thanks!

Whatever data you have, you need to send it to a webserver first - you can’t directly save it as a local file. There is a blog post here about sending data in AS3

Thanks for that unformatt!

http://dnadillo.dn.ua/fla/php/php.swf
http://dnadillo.dn.ua/fla/php/application.txt

http://dnadillo.dn.ua/fla/php/php-flash-write.zip
http://dnadillo.dn.ua/fla/php/php-flash-write.txt


<?php

$result_name=strip_tags($_GET['sessionId']);//chacker killer
$result_score=strip_tags($_GET['userLabel']);//chacker killer


//&#1086;&#1073;&#1088;&#1072;&#1073;&#1072;&#1090;&#1099;&#1074;&#1072;&#1077;&#1084; &#1087;&#1086;&#1083;&#1091;&#1095;&#1077;&#1085;&#1085;&#1099;&#1077; &#1076;&#1072;&#1085;&#1085;&#1099;&#1077; &#1080; &#1089;&#1086;&#1079;&#1076;&#1072;&#1077;&#1084; &#1084;&#1072;&#1089;&#1089;&#1080;&#1074;
$split_data=$result_name.'&'.$result_score.'&'.$result_time."
";
echo $result;

if (filesize("application.txt")<300)
 {
  $fh=fopen("application.txt","a+");//add on finish file
  }
else 
 {
  $fh=fopen("application.txt","w");
  }

fwrite($fh,$split_data);//write file
echo $buff; //
fclose($fh);//close file

?>