hi. I’ve tried running a .swf file on my website, which is supposed to call upon a .php file to create a .txt file. The .swf also specifies the name of the file, and its content. Below is what I currently tried, and expectedly, it failed Please tell me what I’m doing wrong! Thanks in advance.
in the .swf file (AS2):
var sendData = new LoadVars();
sendData.name = "myfile";
sendData.body = "hello this is text lol";
sendData.sendAndLoad("http://www.kotr-tao.com/createText.php",sendData,"GET");
sendData.onLoad = function(suc) {
if (suc == true) {
txt.text = "Sent!"; //txt is a dynamic textbox in the first frame
} else {
txt.text = "Failed!";
}
};
**in the .php file (createText.php):
**
<?php
$name = $_GET['name'];
$body = $_GET['body'];
$cname = trim($name);
if (!empty($cname))
{
$theFile = $name;
$fp = fopen($theFile, 'w');
fwrite($fp, $body);
fclose($fp);
}
?>