0 Replies Latest reply on Apr 20, 2006 12:14 AM by spinmar

    FileReference question

    spinmar
      Hi all,
      I have a stupid question about FileReference.
      I have a movieclip, which I have downloaded from serverX: now I want to upload this Movieclip to a cgi script in serverX.
      I have tried this code, where loadClip is my clip which I created with

      this.createEmptyMovieClip("loadClip", 999)
      loadClip.loadMovie(" http://myserver.com/pluto.swf?z=" + new Date().getTime());

      /* My code */

      var listener = new Object();

      listener.onSelect = function(file:FileReference):Void {
      trace("onSelect");

      }

      listener.onCancel = function(file:FileReference):Void {
      trace("onCancel");
      }

      listener.onOpen = function(file:FileReference):Void {
      trace("onOpen");
      }

      listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
      trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
      }

      listener.onComplete = function(file:FileReference):Void {
      trace("onComplete: " + file.name);
      status = undefinded;
      }

      listener.onHTTPError = function(file:FileReference):Void {
      trace("onHTTPError: " + file.name);
      }

      listener.onIOError = function(file:FileReference):Void {
      trace("onIOError: " + file.name);
      }

      listener.onSecurityError = function(file:FileReference, errorString:String):Void {
      trace("onSecurityError: " + file.name + " errorString: " + errorString);
      }

      var fileRef:FileReference = new FileReference();
      fileRef.addListener(listener);
      fileRef.name = loadClip;

      if(!file.upload(" http://myserver.com/cgi-bin/pippo")) {
      trace("Upload dialog failed to open.");
      }
      /* End code */

      I always get the error: Upload dialog failed to open

      Can someone give me some advice?
      Where is my mistake?
      How can I load to FileReference an existing movieclip?