Lo que quier hacer es escribir el txt, mandando las variables desde el .swf y mediante el php escribir...
Creo que este codigo esta bien...y seguiria revisando el PHP, queria saber si alguien me puede decir si hay algun error, o si el .fla esta bien...Igualmente pongo el PHP para q vean de q se trata...
En PHP use el metodo "w" para crear el .txt o sobreescribirlo, igualmente lo cree texto le puse como nombre...
El .fla:
Cita:
El phpmyData = new LoadVars()
myData.onLoad = function(){
if(this.writing=="ok") {
gotoAndStop(2)
status.text = "Submited data was saved"
} else status.text = "Error in saving submitted data"
}
submit.onPress = function(){
if(Title.text!="" && Comments.text !="" && Image.text!=""){
myData.Title = Title.text;
myData.Comments = Comments.text;
myData.Image = Image.text;
myData.sendAndLoad("save.php", myData, "POST")
}
}
stop()
myData.onLoad = function(){
if(this.writing=="ok") {
gotoAndStop(2)
status.text = "Submited data was saved"
} else status.text = "Error in saving submitted data"
}
submit.onPress = function(){
if(Title.text!="" && Comments.text !="" && Image.text!=""){
myData.Title = Title.text;
myData.Comments = Comments.text;
myData.Image = Image.text;
myData.sendAndLoad("save.php", myData, "POST")
}
}
stop()
Cita:
<?php
//Capture data from $_POST array
$title = $_POST['Title'];
$comments = $_POST['Comments'];
$image = $_POST['Image'];
//Make one big string in a format Flash understand
$toSave ="Title=$title&Comments=$comments&Image=.$image ";
//Open a file in write mode
$fp = fopen("texto.txt", "w");
if(fwrite($fp, $toSave)) echo "writing=ok&";
else echo "writing=Error&"
fclose($fp);
?>
//Capture data from $_POST array
$title = $_POST['Title'];
$comments = $_POST['Comments'];
$image = $_POST['Image'];
//Make one big string in a format Flash understand
$toSave ="Title=$title&Comments=$comments&Image=.$image ";
//Open a file in write mode
$fp = fopen("texto.txt", "w");
if(fwrite($fp, $toSave)) echo "writing=ok&";
else echo "writing=Error&"
fclose($fp);
?>