hi guys i recently moved an application from flex 2 to flex 3 as is without 
changing the code. the file upload code in flex 2 was working perfectly but in 
flex 3 it's non responsive as in it can browse for files on the pc but cant 
upload them.. below is my code please help me.


        private var fileRef:FileReference;
        
        //Define reference to the Upload ProgressBar component.
        private var progress_win:progress_popup;
        
    private function init():void
    {
        fileRef = new FileReference();
        fileRef.addEventListener(Event.SELECT, fileRef_select);         
        fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler);
        fileRef.addEventListener(Event.COMPLETE, fileRef_complete);
    }

    private function browseAndUpload():void
    {
        fileRef.browse();
        message.text = "";
    }

    private function fileRef_select(event:Event):void 
    {
        var request:URLRequest = new 
URLRequest("http://localhost:8500/App/src/cfcs/upload.cfm";)
        try 
        {
                fileRef.upload(request);
        } 
        catch (err:Error)
        {
                message.text = "ERROR: zero-byte file";
        }       
        memPhoto.text = event.currentTarget.name;
        createdprogressPopup();
        progress_win.uploadProgress.setProgress(0, 100);
        progress_win.uploadProgress.label = "Loading 0%";
        }            

    private function fileRef_complete(event:Event):void
    {
        message.text += " (complete)";
        removeMe();
    }
    
    private function createdprogressPopup():void{
        
progress_win=progress_popup(PopUpManager.createPopUp(this,progress_popup,true));
    }
                
    private function removeMe():void {
        PopUpManager.removePopUp(progress_win);
    }
                
    private function progressHandler(event:ProgressEvent):void{
        progress_win.uploadProgress.setProgress(event.bytesLoaded, 
event.bytesTotal);                   
    }


"upload.cfm"
<cffile action="upload" filefield="Filedata" destination="#ExpandPath('./')#" 
nameconflict="OVERWRITE" />

Reply via email to