3 Replies Latest reply on Sep 28, 2009 4:58 PM by cyber0897

    Queue multi file uploader help

    cyber0897 Level 1

      hey guys... so i need some serious help... im trying to create a multiple file image uploader...

      basically, what i need my app to happen is when you select files, it needs to start uploading the images immidiately, with a progress bar...

      i have been unable to build this out in action script... i got the one file uploader to work just fine...


      the code i had towards the end of the one file uploader is


          public var fileRef:FileReference = new FileReference();
          public var imgCollection:ArrayCollection = new ArrayCollection();
          public var imgService:Images = new Images();
          public var imageData:ImageData = new ImageData();
          public var returnMsg:ReturnMessage = new ReturnMessage();


          public function onBrowseButtonClicked(event:MouseEvent):void{
              var arr:Array = [];
              arr.push(new FileFilter("Images", ".gif;*.jepg;*.jpg;*.png"));
              fileRef.addEventListener(Event.SELECT, fileRef_select);
              fileRef.addEventListener(Event.COMPLETE, fileRef_complete);
          public function fileRef_select(event:Event):void{
          public function fileRef_complete(event:Event):void{
              var fileByteArr:ByteArray = fileRef.data;
              var b64En:Base64Encoder = new Base64Encoder();


              var str:String = b64En.flush();
      //        trace(str);
              //trace("------------------------------------      " + str + "     -----------------------------");
              imageData.Base64EncodedImage = str;
              imageData.FileName = "nameofstring";


              //imgService.addEventListener(FaultEvent.FAULT, servFault);
              imgService.addEventListener(ResultEvent.RESULT, imgServSuccess);
          public function imgServSuccess(event:ResultEvent):void{
              Alert.show("the result");
              returnMsg = event.result as ReturnMessage;
              var returnedData:Object = event.result.Images;
              trace("length: " + event.result.Images.length);
                  for each(var imgData:ImageData in returnedData){
                      var decoded:Base64Decoder = new Base64Decoder();
                      var byteArr:ByteArray = decoded.toByteArray();
                      img.source = byteArr;





      as you can see, once the image is selected, it is converted into base64, and the passed onto the server using the function UploadImage...


      any help or ideas would be greatly appretiated!!


      thank you soo much!