Ustag Posted April 26, 2011 Share Posted April 26, 2011 Hi im trying to figure out how a file uploader works in flash.This is my code now: import flash.events.MouseEvent;ulBtn.addEventListener(MouseEvent.CLICK, selectFile);function selectFile(event:MouseEvent):void{ var fileRef:FileReference = new FileReference(); fileRef.addEventListener(Event.SELECT, selectHandler); fileRef.addEventListener(Event.COMPLETE, completeHandler); try { var success:Boolean = fileRef.browse(); } catch (error:Error) { trace("Unable to browse for files."); } function selectHandler(event:Event):void { var request:URLRequest = new URLRequest("http://www.mycomain.com/upload.php"); try { fileRef.upload(request); } catch (error:Error) { trace("Unable to upload file."); } } function completeHandler(event:Event):void { trace("uploaded"); }}This means that when I press ulBtn I get to pick a file that I should upload. Then it runs upload.php to add the file to the database and upload the file on the server but how do I know the file name variable for upload.php to add it to the database? Link to comment Share on other sites More sharing options...
astralaaron Posted March 14, 2012 Share Posted March 14, 2012 I haven't done this with flash before but maybe try doing print_r($_FILES); and see if it is showing up in that array Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.