as3 to php file upload

Hello i have been wandering the internet for several days and can’t find an answer to my file uploader nightmare, i just want to upload a file from flash via php, i have been using the FileReference class but as soon as i try to upload it nothing happens or at least it tells me its complete in super quick time but nothing has been uploaded and there has been no POST request fired i have checked my directorie paths and they are fine but no joy.

Any help to solve this is hugely appreciated i proper want to get this to work, would be cool to finally get php working with flash for the first time.

below is my code to help see:


import flash.events.*;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.system.Security;

Security.allowDomain("http://127.0.0.1/");

var _uploadUrl:URLRequest;
var _fileName:String;
var _fileRef:FileReference;

_uploadUrl = new URLRequest();
_uploadUrl.url = "http://127.0.0.1/spazy/ftp_v2/build/fileUploader.php";
_fileRef = new FileReference();

upload_btn.buttonMode = true;
browse_btn.buttonMode = true;

//config listeners
_fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler);
_fileRef.addEventListener(Event.COMPLETE, completeHandler);
_fileRef.addEventListener(Event.SELECT, selectHandler);
_fileRef.addEventListener(IOErrorEvent.IO_ERROR, IOHandler);
browse_btn.addEventListener(MouseEvent.MOUSE_DOWN, browse);
upload_btn.addEventListener(MouseEvent.MOUSE_DOWN, upload);

function progressHandler(e:ProgressEvent):void{
    trace("progress");
    file_txt.text = "progressHandler: name=" + _fileRef.name + " bytesLoaded=" + e.bytesLoaded + " bytesTotal=" + e.bytesTotal;
}

function completeHandler(e:Event):void{
    //file_txt.text = "complete = "+e;
}

function selectHandler(e:Event):void{
    trace("selected");
    _fileRef = FileReference(e.target);
    file_txt.text = FileReference(e.target).name;
}

function IOHandler(ie:IOErrorEvent):void{
    file_txt.text = "IO Error = "+ie;
}

function browse(me:MouseEvent):void{
    _fileRef.browse();
}

function upload(me:MouseEvent):void{
    trace("upload");
    _fileRef.upload(_uploadUrl);
}

cheers.