0 Replies Latest reply on Dec 11, 2006 1:27 PM by Newsgroup_User

    Flash 8 file upload .doc & .pdf help, please

    Level 7
      I've been working with the file upload sample that came with Flash 8 as well
      as other sources to help me figure this one out... like:


      Everything I seem to find out about file uploading with Flash specifically
      deals with images, but I need to upload .doc & .pdf files to attach to an
      email as part of an employment application process for a site that is built
      with Flash.

      The back-end script is a simple ColdFusion file that I've tested (and works
      fine with a static HTML test page):

      <cffile action="upload"
      destination = "ServerAddressHERE"
      accept = "image/jpg, application/msword, application/pdf"
      fileField = "Form.resumeFile"
      nameConflict = "Overwrite">

      The Flash example script that comes with Flash 8 has been modified as

      System.security.allowDomain(" FQDN_here");
      import flash.net.FileReference;

      // The listener object listens for FileReference events.
      var listener:Object = new Object();

      // When the user selects a file, the onSelect() method is called, and
      // passed a reference to the FileReference object.
      listener.onSelect = function(selectedFile:FileReference):Void {

      // Update the TextArea to notify the user that Flash is attempting to
      // upload the image.
      statusArea.text += "Attempting to upload " + selectedFile.name + "\n";

      // sample code provided by Flash
      selectedFile.upload(" http://www.helpexamples.com/flash/file_io/uploadFile.php");

      // my modification here (I have tried absolute references as well):

      listener.onOpen = function(selectedFile:FileReference):Void {
      statusArea.text += "Opening " + selectedFile.name + "\n";

      // Once the file has uploaded, the onComplete() method is called.
      listener.onComplete = function(selectedFile:FileReference):Void {

      // Notify the user that Flash is starting to download the image.
      statusArea.text += "Downloading " + selectedFile.name + " to player\n";

      // this part is irrelevant to my needs and I've worked with and without it
      imagesCb.selectedIndex = imagesCb.length - 1;

      var imageFile:FileReference = new FileReference();
      uploadBtn.addEventListener("click", uploadImage);

      // this part is irrelevant to my needs and I've worked with and without it
      imagesCb.addEventListener("change", downloadImage);
      imagePane.addEventListener("complete", imageDownloaded);
      function imageDownloaded(event:Object):Void {
      if(event.total == -1) {
      imagePane.contentPath = "Message";

      // this part is where I added the extensions I need:
      function uploadImage(event:Object):Void {
      imageFile.browse([{description: "Image Files", extension:


      ANY ideas would be sincerely appreciated... even if it's just to confirm
      that the Flash file upload process ONLY works with image files.... Thank you
      ALL in advance for ANY help I can get. :-)