Welcome to WebmasterWorld Guest from 54.163.159.27

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Server response with Flex and PHP

     
1:02 pm on Sep 27, 2007 (gmt 0)

New User

10+ Year Member

joined:June 9, 2005
posts: 38
votes: 0


I have a working upload swf that does a batch upload and then uses FileReference and PHP to put the file in the right place. However, I have two things that I'm trying to do.

1. I'm trying to pass more than one value to the upload.php script. I know I can do it using HTTPService, but I'm having trouble getting HTTPService to pass text values along when the file is uploaded.

2. I want to get information back from upload.php, something like
<?
$filestatus = move_uploaded_file($file_temp,$file_path."/".$file_name);
if(!$filestatus) {
echo "Upload failed. Please try again.";
}
?>
and have it show up in a textarea or something.
Once again, I know how to do it with HTTPService, but I don't know how to make the FileReference trigger the HTTPService and listen to the result.

1:12 pm on Sept 27, 2007 (gmt 0)

New User

10+ Year Member

joined:June 9, 2005
posts: 38
votes: 0


I think I found the answer to #1 with URLVariables.

var sendVars:URLVariables = new URLVariables();
sendVars.action = "upload";
sendVars.username = {txtUsername.text};

which should let me pass any variables that I want to the upload.php script.

9:04 pm on Sept 27, 2007 (gmt 0)

New User

10+ Year Member

joined:June 9, 2005
posts: 38
votes: 0


I figured out the answer to #2
_refUploadFile.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadDataComplete);

this is an event that triggers when the upload is completed and data is returned.