2 Replies Latest reply on Nov 17, 2009 11:57 PM by lukasnemecek

    UrlLoader - image upload with progressbar


      Hi, I'm selecting a file from computer via FileReference.browse and then resize selected image, if its dimensions are too big.

      Then I'm uploading it to the server by UrlLoader. It works fine, but I'm not able to display progressbar. Is there any possibility to do so?

      I was thinking about putting the data back to FileReference, but unfortunately, property "data" is read-only.


      Any ideas?


      Thank you

        • 1. Re: UrlLoader - image upload with progressbar
          satyajitbehera Level 1

          Have you handled the upload progress. Try using -


          instanceFileReferenceName.addEventListener(ProgressEvent.PROGRESS, progressHandler);


          private function progressHandler(event:ProgressEvent):void


                           var file:FileReference = FileReference(event.target);

                           trace("progressHandler name=" + file.name + " bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);



          Instead of the trace statement, you can use those values in the UI showing the progress status. Also you can calculate the percentage from the bytesLoaded and bytesTotal properties of ProgressEvent. I hope this helps

          • 2. Re: UrlLoader - image upload with progressbar
            lukasnemecek Level 1

            Hi, thanks for reply, but I can't use FileReference, because data from client PC were modified before uploading it to server.