Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/10/2007, 09:06
eybel
 
Fecha de Ingreso: marzo-2007
Mensajes: 782
Antigüedad: 17 años, 1 mes
Puntos: 16
escribiendo en txt..

Bueno no puedo hacer q funcione esto...Modifique varias veces el codigo, pero no termina de funcionar...Y segui un tutorial que hablaba de esto...

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:
myData = 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()
El php


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);
?>

Última edición por eybel; 30/10/2007 a las 09:15