1 Reply Latest reply on Aug 4, 2011 11:21 AM by saisri2k2

    Image loading via FileReference returns not visible image

    demkalkov Level 1

      Hello everybody.


      I've got a problem on loading an image.

      I need to load the selected image, to show it in Flex and upload to the server.


      private function fileSelected(evt : Event):void{
           (evt.target as FileReference).load();
      private static function fileLoaded(evt : Event):void{
           mateDispatcher.dispatchEvent(new AppEvent(AppEvent.FILE_LOADED,true,false,evt.target,filename));               
           uploadFile(evt.target as FileReference,filename);
      private static function uploadFile(fileRef : FileReference, filename : String):void{
           var request : URLRequest = new URLRequest();
           request.url = WEB::UPLOAD_IMAGE;
           request.method = URLRequestMethod.POST;
           fileRef.upload(request, "file");


      private function fileLoadHandler(evt : AppEvent):void{
           var img : Image = new Image();
           img.source = (evt.data As FileReference).data;



      When the image is loaded it is sended to other class called "Area".


      This code workes fine on my local network, but the image is not appearing when moved to production server.

      Every event 'fileLoadHandler' handles the event - 100%.

      (evt.data as FileReference).data is not null but there is still no image.


      Please help.