Flex CRUD - How do YOU Handle File Uploads as part of an admin form?
I guess my questions would be whether doing an http form post (and attaching a file to it) is easy in Flex. Second question would be whether this is the most common approach, and third would be for this kind of use case, how else would you solve the communication between flex and the server? Can you drop a BLOB into an XML packet or even a formal SOAP call? Are there standard approaches for doing this in Flex?
Just to clarify, this use case is distinct from a Flex file upload tool optimized for uploading multiple files that are independent of other data. I'm looking to have a way of uploading a User with first name, last name, DoB, resume and photo and am just wondering the default approach and perhaps any other alternatives . . .
Any input wildly appreciated!


eom.
Without getting into using a session, I uploaded the file then sent the filecontents back to flex using 'cffile action="readbinary" ...' then Base64Encoded the contents with cfoutput. Now, the flex client will recieve a data_upload_complete event (or something). Once that event fires, the base64Encoded string is in event.data. You can use the mx.utils.Base64Decoder to decode this text and drain() it to a bytearray. Once your VO contains the bytearray, you can send it to the server as normal and it will contain your blob field.
I probably listed the wrong functions/class names but this might put you in the right direction. You can always email me and I will send you an example. I was going to blog about this but... my blog has been dead for too long.
Scotty
Gotta love that the sample Adobe code is in PHP :-<
I see you can add additional properties using URLRequest.method and URLRequest.data, but I'm guessing you can't include more than one file upload field (as opposed to supporting multiple files in a single field using FIleReferenceList.browse - I mean a separate field for selecting a single resume and a single photo from different locations with different properties).
Just seems a little strange to unbundle something that was already usefully bundled. Maybe I'm just not "thinking in Flex" yet.
We are using Flash remoting now for data transfer between client and the server, but we had started at the beginning from HTTP POST/GET requests too, this definitely can be an option for you too.
I can share the screenshot of UI with you offlist and discuss technical implementation.
I'd love to see the screen shot if you don't mind. I'm completely new to Flex and honestly at the moment am looking at this more from a "what should my service layer API be to support flex" than a "how can I finish my flex application", but it won't be long until I have to fire up Flex builder and make some sense out of this, so thanks very much for the offer!
I'll ping you offline.
As usual, there are strengths and weaknesses.
Thanks for the info - will check it out!