[flexcoders] File uploads with JSON?
Is it possible to use JSON to do file uploads in Flex to a Java servlet? - Alex C
Re: [flexcoders] File uploads with JSON?
What is the point of using JSON to do that? On Tue, Mar 3, 2009 at 8:32 PM, oneworld95 oneworl...@yahoo.com wrote: Is it possible to use JSON to do file uploads in Flex to a Java servlet? - Alex C
Re: [flexcoders] file uploads
code from the docs. I am just trying to get a file upload working so I can make sure I understand it correctly.On 7/5/06, Carson Hager [EMAIL PROTECTED] wrote: What code are you referring to? Carson Carson HagerCynergy Systems, Inc.http://www.cynergysystems.comEmail: [EMAIL PROTECTED]Office: 866-CYNERGYMobile: 1.703.489.6466 From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Clint TredwaySent: Tuesday, July 04, 2006 11:32 PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] file uploads I am using the code from the docs and Flex Builder is telling this 1120: Access of undefined property fileRef. and that the selectHandler and completeHandler are undefined properties as well. I am declaring the var fileRef, so i dont get why its doing this... very frustrating... -- diabetic? http://www.diabetesforums.com Bill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. -- diabetic? http://www.diabetesforums.comBill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] file uploads
Hard to respond without seeing the code (a link or a paste of the text would be good). But I suspect the code presumes event handlers that are not implemented in the snippet you are using. fileRef needs at least one event handler to handle what the user does when he selects an item for upload, and lots of other stuff. You need some code that looks like this: p_fileReference.addEventListener(Event.CANCEL, onCancel); p_fileReference.addEventListener(Event.COMPLETE, onComplete); p_fileReference.addEventListener( IOErrorEvent.IO_ERROR, onIOError); p_fileReference.addEventListener(Event.OPEN, onOpen); p_fileReference.addEventListener(ProgressEvent.PROGRESS, onProgress);// p_fileReference.addEventListener( SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); p_fileReference.addEventListener(Event.SELECT, onSelect);This code should be called when you instantiate the fileRefrence.the on parameters above are references to functions that handle events. Their declarations look something like this: public function onSelect(p_event:Event) :void { public function onCancel(p_event:Event) :void { public function onOpen(p_event:Event) :void { public function onComplete (p_event:Event) :void { public function onProgress (p_event:ProgressEvent):void{ public function onIOError(p_event:IOErrorEvent) :void {Hope this helps.RegardsHankOn 7/6/06, Clint Tredway [EMAIL PROTECTED] wrote: code from the docs. I am just trying to get a file upload working so I can make sure I understand it correctly.On 7/5/06, Carson Hager [EMAIL PROTECTED] wrote: What code are you referring to? Carson Carson HagerCynergy Systems, Inc.http://www.cynergysystems.comEmail: [EMAIL PROTECTED]Office: 866-CYNERGYMobile: 1.703.489.6466 From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Clint TredwaySent: Tuesday, July 04, 2006 11:32 PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] file uploads I am using the code from the docs and Flex Builder is telling this 1120: Access of undefined property fileRef. and that the selectHandler and completeHandler are undefined properties as well. I am declaring the var fileRef, so i dont get why its doing this... very frustrating... -- diabetic? http://www.diabetesforums.com Bill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. -- diabetic? http://www.diabetesforums.com Bill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] file uploads
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. On 7/5/06, Carson Hager [EMAIL PROTECTED] wrote: What code are you referring to? Carson Carson Hager Cynergy Systems, Inc. http://www.cynergysystems.com Email: [EMAIL PROTECTED] Office: 866-CYNERGY Mobile: 1.703.489.6466 From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Clint Tredway Sent: Tuesday, July 04, 2006 11:32 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] file uploads I am using the code from the docs and Flex Builder is telling this 1120: Access of undefined property fileRef. and that the selectHandler and completeHandler are undefined properties as well. I am declaring the var fileRef, so i dont get why its doing this... very frustrating... -- diabetic? http://www.diabetesforums.com Bill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. -- diabetic? http://www.diabetesforums.com Bill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. -- __ 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] file uploads
Thanks Phil... that helped alot. I was basically doing the same thing but I must have had something out of order. Now I can finish this project :)On 7/6/06, Phil Marston [EMAIL PROTECTED] wrote: 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. On 7/5/06, Carson Hager [EMAIL PROTECTED] wrote: What code are you referring to? Carson Carson Hager Cynergy Systems, Inc. http://www.cynergysystems.com Email: [EMAIL PROTECTED] Office: 866-CYNERGY Mobile: 1.703.489.6466 From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Clint Tredway Sent: Tuesday, July 04, 2006 11:32 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] file uploads I am using the code from the docs and Flex Builder is telling this 1120: Access of undefined property fileRef. and that the selectHandler and completeHandler are undefined properties as well. I am declaring the var fileRef, so i dont get why its doing this... very frustrating... -- diabetic? http://www.diabetesforums.com Bill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. -- diabetic? http://www.diabetesforums.com Bill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. -- __ Phil Marston Learning TechnologistLearning 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 2006Booking is essential www.abdn.ac.uk/openday email [EMAIL PROTECTED] or call 0800 027 1495 -- diabetic? http://www.diabetesforums.comBill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web
[flexcoders] file uploads
I am using the code from the docs and Flex Builder is telling this 1120: Access of undefined property fileRef. and that the selectHandler and completeHandler are undefined properties as well. I am declaring the var fileRef, so i dont get why its doing this... very frustrating... -- diabetic? http://www.diabetesforums.comBill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. __._,_.___ -- 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
RE: [flexcoders] file uploads
What code are you referring to? Carson Carson HagerCynergy Systems, Inc.http://www.cynergysystems.comEmail: [EMAIL PROTECTED]Office: 866-CYNERGYMobile: 1.703.489.6466 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Clint TredwaySent: Tuesday, July 04, 2006 11:32 PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] file uploads I am using the code from the docs and Flex Builder is telling this 1120: Access of undefined property fileRef. and that the selectHandler and completeHandler are undefined properties as well. I am declaring the var fileRef, so i dont get why its doing this... very frustrating... -- diabetic? http://www.diabetesforums.comBill Cosby - A word to the wise ain't necessary - it's the stupid ones that need the advice. __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___