Tuesday, March 30, 2010

Upload file using filereference not...

Hello,

I'm not sure what is causing my problem. I have an upload script pretty much out of the docs that works when I debug the movie locally, but when I upload it to me server it appears to halt at my file.upload(request); not even triggering an Event.Open event.

the php script is out of the docs http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?c ontext=LiveDocs_Parts%26amp;file=00000320.html

any ideas

thanks

O

script:

var fileRefList:FileReferenceList = new FileReferenceList();

fileRefList.addEventListener(Event.SELECT, selectHandler);

upload_btn.addEventListener(MouseEvent.CLICK, chooseFile);

function chooseFile(event:MouseEvent):void {

fileRefList.browse();

}

function selectHandler(event:Event):void {

alert.text=''select Handler'';

var request:URLRequest=new URLRequest(''http://www.condechi.com/upload.php'');

var file:FileReference;

var files:FileReferenceList=FileReferenceList(event.target);

var selectedFileArray:Array=files.fileList;

for (var i:uint = 0; i %26lt; selectedFileArray.length; i++) {

file=FileReference(selectedFileArray[i]);

file.addEventListener(Event.COMPLETE, completeHandler);

file.addEventListener(Event.OPEN,startUpload);

file.addEventListener(ProgressEvent.PROGRESS, prog)

try {

alert.text=''try'';

file.upload(request);

} catch (error:Error) {

alert.text=''Unable to upload files.'';

trace(''Unable to upload files.'');

}

}

}

function prog(event:ProgressEvent):void{

alert.text=''Prog: ''+event;

}

function startUpload(event:Event):void{

alert.text=''starting upload'';

}

function completeHandler(event:Event):void {

alert.text=''uploaded'';

trace(''uploaded'');

}

Upload file using filereference not...

you probably have a cross-domain security issue.

No comments:

Post a Comment