FileReference send a variable to PHP

Hi,

How would you send a variable to PHP from Flash CS2 using FileReference.
I’m trying to upload an image to the server no problem there it works great but I need to specify the folder name in flash and send it as a variable to PHP and can’t figure out how to do this.

Your help is greatly appreciated.

See code below.

import flash.net.FileReference;
imagePane.setSize(400, 350);
imagePane.move(75, 25);
uploadBtn.move(75, 390);
uploadBtn.label = “Upload Image”;
imageLbl.move(75, 430);
imageLbl.text = “Select Image”;
statusLbl.move(210, 390);
statusLbl.text = “Status”;
imagesCb.move(75, 450);
statusArea.setSize(250, 100);
statusArea.move(210, 410);

/* The listener object listens for FileReference events. /
var listener:Object = new Object();
/
When the user selects a file, the onSelect() method is called, and passed a reference to the FileReference object. /
var ths=this;
listener.onSelect = function(selectedFile:FileReference):Void {
/
Update the TextArea to notify the user that Flash is attempting to upload the image. /
statusArea.text += "Attempting to upload " + selectedFile.name + "
";
/
Upload the file to the PHP script on the server. /
selectedFile.upload(“uploadFile.php”);
/
When the file begins to upload, the onOpen() method is called, so notify the user that the file is starting to upload. /
listener.onOpen = function(selectedFile:FileReference):Void {
statusArea.text += "Opening " + selectedFile.name + "
";
};
/
When the file has uploaded, the onComplete() method is called. /
listener.onComplete = function(selectedFile:FileReference):Void {
/
Notify the user that Flash is starting to download the image. /
statusArea.text += "Downloading " + selectedFile.name + " to player
";
/
Add the image to the ComboBox component. /
imagesCb.addItem(selectedFile.name);
/
Set the selected index of the ComboBox to that of the most recently added image. /
imagesCb.selectedIndex = imagesCb.length - 1;
/
Call the custom downloadImage() function. /
downloadImage();
};
var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);
//
imagePane.addEventListener(“complete”, imageDownloaded);
imagesCb.addEventListener(“change”, downloadImage);
uploadBtn.addEventListener(“click”, uploadImage);
//
/
If the image does not download, the event object’s total property will equal -1. In that case, display a message to the user. /
function imageDownloaded(event:Object):Void {
if (event.total == -1) {
imagePane.contentPath = “Message”;
}
}
/
When the user selects an image from the ComboBox, or when the downloadImage() function is called directly from the listener.onComplete() method, the downloadImage() function sets the contentPath of the ScrollPane in order to start downloading the image to the player. /
function downloadImage(event:Object):Void {
imagePane.contentPath = “images/” + imagesCb.value;
}
/
When the user clicks the button, Flash calls the uploadImage() function, and it opens a file browser dialog box. /
function uploadImage(event:Object):Void {
imageFile.browse([{description: “Image Files”, extension: "
.jpg;.gif;.png"}]);
}