We answered this one a day or two ago, check the archives. 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of ghus32
Sent: Tuesday, June 24, 2008 1:57 PM
To: [email protected]
Subject: [flexcoders] passing data from PHP to Flex

 

Hello everyone,

I have an upload script that I am using in Flex with PHP. The upload 
function is working fine, but I want to pass data from the serverside 
script back to the app. I want to communicate the message part in the 
php back to Flex.

HOw would I go about doing this..

My PHP code is below

$uploaddir = TEMPLATE_DIRECTORY;
$filename= trim($_FILES['file']['name']);

if(is_uploaded_file($_FILES['file']['tmp_name']))
{


$id = time().mt_rand(0,10000);
$file = $id;


move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.$file);

$filepath=$uploaddir.'/';

$query_filename= "INSERT INTO template(name, location, temp_name) 
VALUES ('$filename', '$filepath' , '$file')";

$result_filename = mysql_query( $query_filename );

}
print "Your file has been uploaded successfully! Yay!";

$message = "<result><message>$file 
uploadedsuccessfully.</message></result>";
echo $message;

 

Reply via email to