Hi!
I have read a little bit about loadVars and loadVariables, so I am trying to read and write to a .txt on my server. This is my functions: (only Read works, but Send doesn't)
function Load(F, VAR) {
var DATA:LoadVars = new LoadVars();
DATA.onLoad = function(success:Boolean) {
if (!success) {
_root.suc.text = "Error loading data";
} else {
_root.dat.text = this[VAR];
}
};
DATA.load(F);
}
function Send(F,D) {
var Obj = new Object();
Obj.F = F;
Obj.D = "var1="+D;
Obj.loadVariables("http://erlendhl.ueuo.com/sl/p/write.php", "POST");
}
Load('http://erlendhl.ueuo.com/sl/p/1/data.txt','var1');
Send('http://erlendhl.ueuo.com/sl/p/1/data.txt','Does this work?????');
Here is my write.php script:
<?php
$NAME = $_POST['F'];
$HANDLE = fopen($NAME, 'w') or die ('CANT OPEN FILE');
fwrite($HANDLE,$_POST["D"]);
fclose($HANDLE);
?>
There are no errors or something; but the file is the same after Send();.
So what am I doing wrong; what to do so it works?
CHMOD in the folder is 777.
here is the swf preview.
Thanks!