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.

  • Client-side
    • Main Flex-generated SWF inside of Flash Player in browser
    • JavaScript to communicate between browser frames
    • HTML form for the actual uploading
  • Server-side
    • 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).


  1. Open upload.cfm for editing.
  2. Set the destination attribute incffile to the path you'd like the uploaded files to be stored in.
  3. Save the changes to the file.
  4. Copy upload.cfm to your ColdFusion Server.
  5. Open one of the index.jsp pages for editing (hidden_index.jsp or sample_index.jsp).
  6. Set the uploadURL attribute to point to the URL of the upload.cfm page.
  7. Copy the JSP and MXML files to your Flex Server.
  8. View the compiled application:

    To see all IFRAMES:

    To hide the extra IFRAMES:


Flex Server

  • sample_index.jsp or hidden_index.jsp
    • Wraps main view
    • Contains
      • other frames as iframes
      • core ActionScript handlers and methods for interframe communication
  • index.mxml
    • Contains
      • application UI
      • glue-code to communicate with JavaScript
      • LocalConnection to communicate between frames
  • uploadConnect.jsp (will be hidden frame in production)
    • Wraps uploadConnect application
    • Used for messaging from JavaScript to Flex
    • 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

ColdFusion server (this can be replaced by other server-side technology for handling upload)

  • upload.cfm
    • Contains
      • HTML form
      • ColdFusion code that handles actual uploading of file


  • This was written and tested on Internet Explorer on Windows and Mac OS-X.
  • This does not work with Opera, Netscape or Mozilla.


This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy