hi guys, i have built a video uploader in flex with a coldfusion backend. what 
i do is allow the user to upload a video file (using cffile) and use ffmpeg to 
convert the file into .flv format(this is because flex videoplayer only plays 
.flv files) which is then stored(file.flv) on the server. this all works 
perfectly, but i want to get the name of the flv file on the server into the 
textinput and store it in the database. how do i do that? here is the code, in 
this case the textinput is filled with the original file name(something like 
file.mov or file.mp4 etc and i want to fill it with the name of the converted 
file eg file.flv)

<?xml version="1.0" encoding="utf-8"?>
<mx:FormItem xmlns:mx="http://www.adobe.com/2006/mxml"; 
creationComplete="init()">
        
        <mx:Script>
                <![CDATA[
                        import mx.managers.PopUpManager;
                        import components.progress_popup;
                        
                        //////////video upload 
//////////////////////////////////////////////////////////////////////////////
                        private const FILE_UPLOAD_URL:String = 
"cfcs/vidUpload.cfm";
                        private var fileRef:FileReference;
                        private var progress_win:progress_popup;
        
        
                private function init():void
                {
                        fileRef = new FileReference();
                        fileRef.addEventListener(Event.SELECT, fileRef_select);
                        fileRef.addEventListener(Event.OPEN, openHandler);
                        fileRef.addEventListener(ProgressEvent.PROGRESS, 
progressHandler);                      
                        fileRef.addEventListener(Event.COMPLETE, 
fileRef_complete);
                }

                private function browseAndUpload():void
                {
                        //var fileFilter:FileFilter = new FileFilter("Files", 
"*.pdf;*.doc;*.docx");
                        fileRef.browse();
                        message.text = "";
                }

                private function fileRef_select(event:Event):void 
                {
                        try 
                        {
                                fileRef.upload(new URLRequest(FILE_UPLOAD_URL));
                        } 
                        catch (err:Error)
                        {
                                message.text = "ERROR: zero-byte file";
                        }       
                        vid.text = event.currentTarget.name;
                        createdprogressPopup();
                        }            

                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);   
                
                }
                
                private function openHandler(event:Event):void {
                        progress_win.uploadProgress.label = "Uploading %3%% of 
image file.";
                }
                ]]>
        </mx:Script>
        
        <mx:HBox width="240">
                <mx:TextInput width="155" id="vid"/>
                <mx:Button label="Browse" click="browseAndUpload();"/>          
                                
        </mx:HBox>
        <mx:Label id="message"/>
</mx:FormItem>


Reply via email to