0 Replies Latest reply on May 4, 2007 10:20 AM by JohnBeahan

    FileReference upload complete event, when error occurs

    JohnBeahan
      Thanks in advance for any assistance you can give me, and I appreciate you sharing your expertise.

      I am using FileReference to upload a file under AS3/FlashPlayer9/Mozilla/Struts/JBoss/WinXP. I have a separate problem getting JBoss to respond correctly to the POST sent by FileReference, but what I am consulting here on this forum about is the fact that the FileReference triggers a 'complete' event (only supposed to happen when http status=200) even when it receives a response of 302 or 404. FileReference reports errors correctly for URL's outside the Struts app, malformed URL's, and security sandbox violations.

      The name of the Struts app is 'mdw' and the Struts Action to handle the uploaded file is named FileUpload. JBoss is responding with 302 to this request, but FileReference triggers 'complete' event regardless. Also, as long as the URL being used is within the same Struts app containing the FileReference upload, (e.g. "/mdw/anything-at-all") it still triggers a 'complete' event, regardless of the actual response status being 404. I've snooped the traffic with Ethereal, and triple-checked the FileReference code, without any insights. Below is my relevant source code.

      public var fr:FileReference = new FileReference();

      public function uploadFile() {
      fr.addEventListener("complete", completeEvent);
      fr.addEventListener("select", selectEvent);
      fr.browse();
      }

      private function completeEvent(e:Event):void {
      trace("Completed OK");
      }

      private function selectEvent(e:Event):void {
      var ur:URLRequest = new URLRequest("/mdw/FileUpload");
      fr.upload(ur, "FileData", false);
      }

      Any ideas or explanations are very welcome.

      John Beahan
      Webalo, Inc.
      jbeahan@webalo.com