I might be reading this the wrong way but in FILE_UPLOAD_ URL you should put 
the path to the server script that will save your file on the server.
C





________________________________
From: Nini7016 Nini7016 <nahloulaha...@hotmail.com>
To: flexcoders@yahoogroups.com
Sent: Thu, June 3, 2010 10:29:17 AM
Subject: [flexcoders] How to upload a file with FileReference ?? Any help 
please :( :(

   
Hello 

In my application, i have to upload a local file and send it to a server.

There is my code : 
............
               private const FILE_UPLOAD_ URL:String = "http://www. 
YOUR-WEBSITE- HERE.com/ fileref/uploader .cfm";
 
               private function init():void 
                {
                    fileRef = new FileReference( );
                    var textTypes:FileFilte r = new FileFilter(" WSDL file", 
"*.pdf ; *.wsdl");
                    xmlTypes= new Array(textTypes) ;
                    
    
                    //the upload
                    fileRef.addEventLis tener(Event. SELECT,fileRef_select);
                    fileRef.addEventLis tener(Event. COMPLETE, 
fileRef_complete) ;

                }

   <mx:Button label="Upload file" id="btn_upload" click="browseAndUpload();"  
x="384" y="59" enabled="true" />
  
        private function browseAndUpload():void 
                {    
                    
                     
                     fileRef.browse(xmlTypes);
                     
                     
                          
                }

                private function fileRef_select(evt:Event): void {
                    try {
                        fileRef.upload( new URLRequest(FILE_ UPLOAD_URL) );
                     //  fileRef.load 
                        //fileRef.save( );
                        //display the name of the file in the AreaText
                        forChange.text = fileRef.name;

                        //fill in the file in the List
                        myCB.dataProvider = fileRef.name;

                    } catch (err:Error) {
                        //message.text = "ERROR: zero-byte file";
                        Alert.show(" ERROR to upload the file");
                    }
                }

When i add fileRef.load in the code that provides ERROR :( :( 
However i don't understand what should i put in the variable FILE_UPLOAD_ URL ??

Any idea please :( 

Thanks for your help 

;)



________________________________
Votre vie privée l'est-elle vraiment ? Internet Explorer 8 vous protège 
gratuitement ! 
 


      

Reply via email to