Type was not found: File. Hmm!?
--- In [email protected], "Tim Hoff" <timh...@...> wrote: > > > Hi, > > One way is to use File instead of FileReference. You can get the > ByteArray that way and pass that to your service. the only caveat is > that you won't be able to track the upload progress; unless you do > something custom with your service. > > private var fileToUpload:File; > private var pptFiles:FileFilter = new FileFilter("PowerPoint Files > (*.ppt)", "*.ppt"); > private var fileTypes:Array = new Array(pptFiles); > > public function browseFiles():void > { > fileToUpload = new File(); > fileToUpload.addEventListener( Event.SELECT, uploadFile ); > fileToUpload.browseForOpen("Open", fileTypes); > } > > > > public function uploadFile( event:Event ):void > { > fileToUpload = event.target as File; > > var fileData:ByteArray = new ByteArray(); > > var stream:FileStream = new FileStream(); > stream.open(fileToUpload, FileMode.READ); > stream.readBytes(fileData, 0, stream.bytesAvailable); > stream.close(); > > // fileData will now contain the ByteArray for the file to upload. > // You can use mx.utils.Base64Encoder.encodeBytes();, or send the > data as is.} > > -TH > > --- In [email protected], "tchredeemed" <apthorp@> wrote: > > > > Hello, I am using RubyAMF to save information to the database. > > > > The FileReference.upload method is causing some issues because > > logically I would like to pass the File information with other > > information rather than just using upload(). > > > > That being said, is there any way to convert FileReference data to > > Base64, I am assuming all file types are able to be encoded in base64, > > is that correct? > > > > Any help would be appreciated! > > > > If not base64, any other way to do it would be great, just need some > > way that I dont have to use FileRef.upload! > > > > thanks! > > >

