Hi Clint, I've just this very moment solved that one! :-) I couldn't get what was going on either, but this is what I did: For the sake of trying it out a created a new application to do it. I left all the imports and var declarations where they were, but put all the rest of the method calls and functions inside another function and then called that function using the creationComplete application tag attribute. see below <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApplication()"> <mx:Script> <![CDATA[ import flash.net.FileFilter; import flash.net.FileReference; import flash.net.URLRequest; public var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *jpeg, *.gif, *.png)","*.jpg; *jpeg; *.gif; *.png"); public var textTypes:FileFilter = new FileFilter("Text Files (*.txt, *rtf)","*.txt; *.rtf"); public var allTypes:Array = new Array(imageTypes, textTypes); public var myFileRef:FileReference = new FileReference(); public function initApplication(): void { myFileRef.addEventListener(Event.SELECT, selectHandler); myFileRef.addEventListener(Event.COMPLETE, completeHandler); myFileRef.browse(allTypes); try { var success:Boolean = myFileRef.browse(); } catch (error:Error) { trace("unable to browse for files"); } function selectHandler (even:Event):void { try { var params:URLVariables = new URLVariables(); params.date = new Date(); var request:URLRequest = new URLRequest("http://www.myplace.com/FlexImageUpload.php"); request.method = URLRequestMethod.POST; request.data = ""> myFileRef.upload(request, "fileField"); } catch (error:Error) { trace("Unable to upload file"); } } function completeHandler(event:Event):void { trace("Uploaded"); } } ]]> </mx:Script> </mx:Application> Clint Tredway wrote: code from the docs. I am just trying to get a file upload working so I can make sure I understand it correctly. -- ______________________________________________________________ Phil Marston Learning Technologist Learning Technology Unit Edward Wright G33, University of Aberdeen, Aberdeen, AB24 3QY, UK [EMAIL PROTECTED] Tel: +44(0)1224 273329 / +44(0)7798 723660 http://www.abdn.ac.uk/diss/ltu/pmarston/ http://www.abdn.ac.uk/diss/ltu/ ______________________________________________________________ The University of Aberdeen Open Day 29th August 2006 Booking is essential www.abdn.ac.uk/openday email [EMAIL PROTECTED] or call 0800 027 1495__._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS
|
- Re: [flexcoders] file uploads hank williams
- Re: [flexcoders] file uploads Phil Marston
- Re: [flexcoders] file uploads Clint Tredway