flex actionscript not uploading file to PHP page HELP!
Posted
by Rees
on Stack Overflow
See other posts from Stack Overflow
or by Rees
Published on 2010-04-07T07:51:20Z
Indexed on
2010/04/07
7:53 UTC
Read the original article
Hit count: 385
hello,
please help! I am using actionscript 3 with flex sdk 3.5 and PHP to allow a user to upload a file -that is my goal. However, when I check my server directory for the file... NOTHING is there! For some reason SOMETHING is going wrong, even though the actionscript alerts a successful upload (and I have even tried all the event listeners for uploading errors and none are triggered). I have also tested the PHP script and it uploads SUCCESSFULLY when receiving a file from another PHP page (so i'm left to believe there is nothing wrong with my PHP).
However, actionscript is NOT giving me any errors when I upload -in fact it gives me a successful event...and I know the my flex application is actually trying to send the data because when I attempt to upload a large file, it takes significantly more time to alert a "successful" event than when I upload a small file.
I feel I have debugged every aspect of this code and am now spent. pleaseeee, anyone, can you tell me whats going wrong?? or at least how I can find out whats happening? -I'm using flash bugger and I'm still getting zero errors.
private var fileRef:FileReference = new FileReference(); private var flyerrequest:URLRequest = new URLRequest("http://mysite.com/sub/upload_file.php");
private function uploadFile():void{ fileRef.browse(); fileRef.addEventListener(Event.SELECT, selectHandler); fileRef.addEventListener(Event.COMPLETE, completeHandler); }
private function selectHandler(event:Event):void{
fileRef.upload(flyerrequest);
}
private function completeHandler(event:Event):void{ Alert.show("uploaded"); }
© Stack Overflow or respective owner