I have also tried to figure this out and through searching found that you can't get the full path because of "sandbox security". --- In [email protected], "Kumar" <[EMAIL PROTECTED]> wrote: > > Hi All, > > > > Below is the code that I am using for uploading files. > > > > In this code I am able to get only name of the file which is to being > uploaded, > > What I want is to get the full path of the file for example > "c:/new/abxfile.txt". > > Can some one help me out of these? > > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" > creationComplete="initApp()"> > > <mx:Script> > > <![CDATA[ > > import mx.controls.Alert; > > import mx.utils.ObjectUtil; > > import flash.events.*; > > import flash.net.FileReference; > > import flash.net.URLRequest; > > > > > > private var fileRef:FileReference; > > > > private function initApp():void { > > fileRef = new FileReference(); > > fileRef.addEventListener(Event.CANCEL, traceEvent); > > fileRef.addEventListener(Event.COMPLETE, completeEvent); > > fileRef.addEventListener(Event.SELECT, selectEvent); > > fileRef.addEventListener(IOErrorEvent.IO_ERROR, traceEvent); > > fileRef.addEventListener(Event.OPEN, traceEvent); > > fileRef.addEventListener(ProgressEvent.PROGRESS, progressEvent); > > fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, > traceEvent); > > } > > > > private function traceEvent(event:Event):void { > > var tmp:String = > "================================\n"; > > ta.text += tmp + event.type + " event:" > + mx.utils.ObjectUtil.toString(event) + "\n" ; > > ta.verticalScrollPosition += 20; > > } > > > > private function > ioErrorEvent(event:IOErrorEvent):void{ > > Alert.show("IOError:" + event.text); > > traceEvent(event); > > } > > > > private function selectEvent(event:Event):void{ > > btn_upload.enabled = true; > > traceEvent(event); > > // Alert.show(String(fileRef.name)); > > filename.text = fileRef.name; > > progressBar.setProgress(0, 100); > > progressBar.label = "Loading 0%"; > > > } > > > > private function > progressEvent(event:ProgressEvent):void { > > > progressBar.setProgress(event.bytesLoaded, event.bytesTotal); > > traceEvent(event); > > } > > > > private function completeEvent(event:Event):void { > > progressBar.label = "Complete."; > > Alert.show(filename.text); > > filename.text += " uploaded"; > > traceEvent(event); > > btn_upload.enabled = false; > > btn_cancel.enabled = false; > > } > > > > private function uploadFile(endpoint:String):void { > > var param:String = "author=" + > ti_author.text; > > var req:URLRequest = new > URLRequest(endpoint); > > req.method = URLRequestMethod.POST; > > Alert.show(String(req.method)); > > fileRef.upload(req, param, false); > > progressBar.label = "Uploading..."; > > > btn_cancel.enabled = true; > > } > > > > ]]> > > </mx:Script> > > > > <mx:Panel title="Flex 2 File Uploading Demo" width="100%" > height="100%" > > > <mx:Form> > > > > <mx:FormItem label="Upload URL:"> > > <mx:TextInput id="uploadURL" > width="100%" text="" enabled="true" /> > > </mx:FormItem> > > > > <mx:FormItem label="Selected File:"> > > <mx:Label id="filename"/> > > </mx:FormItem> > > > > <mx:FormItem label="Upload By:"> > > <mx:TextInput id="ti_author" > text="Author" /> > > </mx:FormItem> > > > > <mx:FormItem direction="horizontal" > width="100%"> > > <mx:Button width="80" > label="Browse" click="fileRef.browse()" /> > > <mx:Button width="80" > label="Upload" id="btn_upload" enabled="false" > click="uploadFile(uploadURL.text)" /> > > <mx:Button width="80" > label="Cancel" id="btn_cancel" enabled="false" click="fileRef.cancel()" /> > > </mx:FormItem> > > > > <mx:HRule width="100%" > tabEnabled="false"/> > > > > <mx:FormItem label="Progress:"> > > <mx:ProgressBar > id="progressBar" mode="manual" /> > > </mx:FormItem> > > > > <mx:FormItem label="Events:"> > > <mx:TextArea id="ta" > width="350" height="200" /> > > </mx:FormItem> > > > > </mx:Form> > > > > </mx:Panel> > > </mx:Application> > > > > > > Thanks > > Kumar >
-- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

