[RESOLVED] FileReference not getting complete event
Let me start by mentioning that I am using a program called "Koolmoves" that outputs AS3 compliant flash for player 9-10.
For some reason my filereference is not recieving COMPLETE event.
Every works fine and file is uploaded etc, and I see the byte total match up in my progress event. but never get the complete event, I also tried the uploadCompleteData event as well and have tried with the PHP code sending a response and also without.
AS3 Code (pb1 and pb2 are buttons)
PHP Code:
import flash.display.Sprite;
import flash.events.*;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.net.FileFilter;
myfile= new FileReference()
mp3Filter = new FileFilter("mp3", "*.mp3");
myfile.addEventListener(ProgressEvent.PROGRESS,fstatus);
myfile.addEventListener(Event.COMPLETE,fileDone);
myfile.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
myfile.addEventListener(Event.SELECT,selectHandler);
function selectHandler(e:Event){
txt2.text=e.target.name;
}
function fstatus(e:Event){
stat.text="status:"+e.bytesLoaded+" of "+e.bytesTotal;
}
function fileDone(e:Event){
stat.text="file uploaded "+e.data;
}
function ioErrorHandler(e:Event){
stat.text="IO ERROR "+e;
}
pb1.addEventListener(MouseEvent.CLICK,bFile);
pb2.addEventListener(MouseEvent.CLICK,sendFile);
function bFile(e:MouseEvent){
myfile.browse([mp3Filter]);
}
function sendFile(e:MouseEvent){
stat.text="Trying to send";
uploadURL = new URLRequest();
uploadURL.url="upload.php";
myfile.upload(uploadURL);
}
THE PHP I'm currently using is pretty simple at this point.
PHP Code:
<?php
$fileName = basename($_FILES["Filedata"]["name"]);
$ok=move_uploaded_file($_FILES["Filedata"]["tmp_name"], $fileName);
echo $ok;
?>
I'm stumped at the moment, and the examples I've found all do pretty much the same coding as I have here.