2 Replies Latest reply on Jun 12, 2010 1:12 AM by cosmits

    FileReference and CFC's

    Kristian Wright Level 1
      I use a FileReference to allow the user to upload images from their PC onto our server. The FileReference URL points to a CFC that does all the processing for us. Part of this precessing is renaming the file, to an indexed name for each user.

      The problem I'm having is that the CFC returns a structure with the new file name in it. However, I cannot access any of this information from the FileReferences' complete handler. I can get the original filename (from currentTarget.name) but this is not the name of the file as it resides on the server!

      Is there anyway to capture a return structure from a FileReference call to a CFC, or should I go about this upload a whole other way?

      Any help appreciated!

      Cheers,
      K.
        • 1. Re: FileReference and CFC's
          Joakim Lundberg

          You have probably already sorted this out since the post is old but here is what you need to do anyway, might be helpful for someone.

           

          var fref:FileReference = ...

           

          //First add a handler for the complete data event

          fref.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadCompleteData);

           

          //Then implement your handler

                  private function uploadCompleteData(evt:DataEvent):void
                  {

                         //The evt.data contains your required response data
                  }

          • 2. Re: FileReference and CFC's
            cosmits Level 1

            hi

            i know it's been a while

            but - is it possible for you to show a script which demonstrate how a filereference can point to a cfc function (and pass aditional parameters...) ?

            it would REALLY help some of us

             

            cheers

            cosmits