Because Macromedia Flash doesn't include the capability to upload files, a Macromedia Flex developer will need to use multiple technologies to add uploading functionality to their Flex application. The following items are required to upload files from Flex applications.
- Main Flex-generated SWF inside of Flash Player in browser
- HTML form for the actual uploading
- ColdFusion MX, JSP, PHP, ASP or a similar technology for receiving and placing the uploaded file on the server
The example provided in this TechNote also uses a frame that wraps a Flex application that wraps a LocalConnection object to simplify inter-frame communication.
This example includes five files that work together to enable file upload from Internet Explorer on Windows or Mac OS X. It also includes instructions for installing on Flex and ColdFusion servers.
Download the example files (5K).
- sample_index.jsp or hidden_index.jsp
- Wraps main view
- other frames as iframes
- core ActionScript handlers and methods for interframe communication
- application UI
- LocalConnection to communicate between frames
- uploadConnect.jsp (will be hidden frame in production)
- Wraps uploadConnect application
- Each time this JSP is reloaded, uploadConnect.mxml sends a message on its LocalConnection
- uploadConnect.mxml (will be hidden in production)
- Wraps LocalConnection
- Only functionality is sending message to all listeners on LocalConnection with values set in wrapping JSP at initialization