Flash Uploader with PHP - Need Help

[COLOR=red]Hi there.[/COLOR]
[COLOR=red][/COLOR]
[COLOR=red]I’m creating a multiple file uploader using a flash interface with a php upload script. I just want to make sure my code’s reading correctly, because I’m a bit of a newbie with all this. Any advice would be welcomed. Thanks. I can include a URL soon if that helps.[/COLOR]


[COLOR=blue]Flash AS Code…[/COLOR]

var currentListItem:Number;
var fullFileBytes:Number;
var progressBar:MovieClip;
var reference:FileReference;
var totalSize:Number;
var referenceList:FileReferenceList = new FileReferenceList();
var listStatus:Array = new Array();
var referenceListener:Object = new Object();
var errorFlag:Boolean = false;
var scriptLocation:String = ‘uploader.php’;
var progressBarHeight:Number = 10;
var progressBarY:Number = 200;
var progressBarColor:Number = 0x66ccff;
referenceList.addListener(referenceListener);
uploadButton_mc._visible = false;
chooseButton_mc.onRelease = choose;
uploadButton_mc.onRelease = uploadCurrent;
referenceListener.onSelect = activateUploadButton;
referenceListener.onProgress = updateProgress;
referenceListener.onComplete = tryNextUpload;
referenceListener.onHTTPError = handleError;
referenceListener.onIOError = handleError;
referenceListener.onSecurityError = handleError;
function activateUploadButton():Void {
currentListItem = 0;
totalSize = 0;
fullFileBytes = 0;
progressBar = makeProgressBar(8, progressBarY);
reference = referenceList.fileList[currentListItem];
reference.addListener(referenceListener);
uploadButton_mc._visible = true;
display_txt.text = ‘’;
for (var i:Number = 0; i<referenceList.fileList.length; i++) {
display_txt.text += referenceList.fileList*.name+’
‘;
listStatus* = ‘0%’;
totalSize += referenceList.fileList*.size;
}
delete i;
}
function choose():Void {
referenceList.browse([{description:‘All Files (.)’, extension:’.’}]);
}
function handleError(errorName:String, detail:Object):Void {
errorFlag = true;
if (arguments.length === 2) {
if (typeof detail === ‘number’) {
listStatus[currentListItem] = ‘HTTP Error #’+detail;
} else {
listStatus[currentListItem] = 'Security Error: ‘+detail;
}
} else {
listStatus[currentListItem] = ‘IO Error’;
}
updateStatusText();
tryNextUpload();
}
function makeProgressBar(x:Number, y:Number):MovieClip {
var bar:MovieClip = createEmptyMovieClip(‘progressBar_mc’, 0);
bar._visible = false;
bar.beginFill(progressBarColor);
bar.lineTo(Stage.width, 0);
bar.lineTo(Stage.width, progressBarHeight);
bar.lineTo(0, progressBarHeight);
bar.lineTo(0, 0);
bar.endFill();
bar._width = 0;
bar._visible = true;
bar._x = x;
bar._y = y;
return bar;
}
function restart():Void {
removeMovieClip(progressBar);
if (errorFlag) {
errorFlag = false;
} else {
display_txt.text = ‘Success! Your files have been uploaded.’;
}
uploadButton_mc._visible = false;
chooseButton_mc._visible = true;
}
function tryNextUpload():Void {
reference.removeListener(referenceListener);
fullFileBytes += reference.size;
if (currentListItem === referenceList.fileList.length-1) {
restart();
} else {
reference = referenceList.fileList[++currentListItem];
reference.addListener(referenceListener);
uploadCurrent();
}
}
function updateProgress(fileReference:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
listStatus[currentListItem] = Math.ceil((bytesLoaded/bytesTotal)100)+’%’;
updateStatusText();
progressBar._width = Math.ceil(Stage.width
((fullFileBytes+bytesLoaded)/totalSize));
}
function updateStatusText():Void {
display_txt.text = ‘’;
for (var i:Number = 0; i<referenceList.fileList.length; i++) {
display_txt.text += referenceList.fileList*.name+’ - ‘+listStatus*+’
';
}
}
function uploadCurrent():Void {
chooseButton_mc._visible = false;
reference.upload(“uploader.php?property=”+property);
}

[COLOR=red]The last function is what I need help with. I have an input box that people can type a name of a property into (called this “property” in the Var box in Flash). What code do I need to include to have this variable correctly send with the upload function??? I’m not so good with syntaxt.[/COLOR]
[COLOR=#ff0000][/COLOR]
[COLOR=#ff0000][/COLOR]
[COLOR=#ff0000][/COLOR]

[COLOR=black]****[/COLOR]
[COLOR=#0000ff]PHP script[/COLOR]
[COLOR=#0000ff][/COLOR]
<?php

$company = $_SESSION[‘Company’];
$branch = $_SESSION[‘Branch’];
$property = $_GET[‘property’];

//what is the directory path I want to upload to?
$uploadDir = $company."/".$branch."/".$property;

//create the directory (should have write permissons)
$old_umask = umask(0);
mkdir($uploadDir, 0777);
umask($oldumask);

//move the uploaded file
$uploadFile = $uploadDir . $_FILES[‘Filedata’][‘name’];
$result = move_uploaded_file($_FILES[‘Filedata’][‘tmp_name’], $uploadFile);
chmod($uploadDir . $_FILES[‘Filedata’][‘name’], 0777);

if ($result)
{
$message = “<result><status>OK</status><message>$file_name uploaded successfully.</message></result>”;
}
else
{
$message = “<result><status>Error</status><message>Something is wrong with uploading a file.</message></result>”;
}

echo $message;

?>

[COLOR=red]should $uploadDir be referred to like this:
$uploadDir = “.”/"$company."/".$branch."/".$property."/"";[/COLOR]
[COLOR=#ff0000][/COLOR]
[COLOR=red]also, should I be using ‘chown’ anywhere???[/COLOR]