1 Reply Latest reply on Nov 20, 2006 7:48 AM by Urban Geezer

    FileReference getting local path

    Urban Geezer
      I have just been researching the flash.net.FileReference class and I wonder if anyone knows how I can access the full local path to the file that the user has selected to upload. What I would like to do is have a small thumbnail of the image about to be uploaded to the server which would be updated when the Event.SELECT is returned. I have tried using FileReference.name but this only gives me the filename and not the complete path. The code I have is as follows:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="horizontal" horizontalAlign="center" verticalAlign="middle">

      <mx:Script>
      <![CDATA[
      import flash.net.FileReference;
      import mx.controls.Alert;
      var myFile:FileReference = new FileReference();


      private function getFile():void{
      myFile.addEventListener(Event.SELECT,select);
      myFile.browse();
      }

      private function select(event:Event):void{
      thumbnail.source = myFile.name;
      }
      ]]>
      </mx:Script>
      <mx:Canvas width="260" height="270">
      <mx:TextInput text="" id="filename" x="10" y="196" editable="true" enabled="true"/>
      <mx:Button label="browse" click="getFile()" x="183" y="196"/>
      <mx:Image x="50" y="10" width="160" height="150" source="" scaleContent="true" autoLoad="true" id="thumbnail"/>
      </mx:Canvas>

      </mx:Application>

      Many thanks in advance..

      Peer.