Jump to content

file uploader


Recommended Posts

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? Edited by Ustag
Link to comment
Share on other sites

  • 10 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...