Problem with FileReference and LoadVars Together

Hi there.

I am currently trying to build a small thing in flash that prompts people to enter their name and some personal details, and upload a picture.

I can do either of these operations just fine by itself, but my question comes down to doing both at the same time.

I use a LoadVars object to upload the values of the TextFields:


var uploadObj:LoadVars = new LoadVars();
var nameSuccess = false;
var locationSuccess = false;
if(nameBox.text == ""){
	messageBox.text = "Please provide a name.
";
	nameSuccess = true;
} else {
	uploadObj.name = nameBox.text;
}
if(locationBox.text == ""){
	messageBox.text += "Please say where you are from.
";
	locationSuccess = true;
} else {
	uploadObj.location = locationBox.text;
}
if(nameSuccess && locationSuccess){
	uploadObj.sendAndLoad("upload.php", uploadObj, "POST");
}

And I use a FileReference object to upload the image file:


listener.onSelect = function(selectedFile:FileReference):Void  {
	selectedFile.upload("uploadFile.php");
}

But my only question is how do I submit both of them at once? Right now the code works through a listener, and uploads once the file is selected (onSelect).

Maybe I’m just missing something really basic, but I can’t seem to figure out a way to submit both the image and the vars in the same call.

And I’ve looked all over the forums and the site for any info.

Any help would be greatly appreciated.

Cheers,

Brekk