How do i get it back into flex on the complete event?
--- In [email protected], claudiu ursica <the_bran...@...> wrote:
>
> I never worked with cold fusion ... however your code on the server writes
> somewhere the file on the disk and names it somehow. The method that does
> that could return the file name in case of a successful save and you can get
> it back into flex on the complete event.
>
> HTH,
> Claudiu
>
>
>
>
> ________________________________
> From: ZIONIST <stinas...@...>
> To: [email protected]
> Sent: Mon, January 4, 2010 3:10:33 PM
> Subject: [flexcoders] how to get the name of a video file after upload
>
>
> 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:FileReferen ce;
> private var progress_win: progress_ popup;
>
>
> private function init():void
> {
> fileRef = new FileReference( );
> fileRef.addEventLis tener(Event. SELECT, fileRef_select) ;
> fileRef.addEventLis tener(Event. OPEN, openHandler) ;
> fileRef.addEventLis tener(ProgressEv ent.PROGRESS, progressHandler) ;
> fileRef.addEventLis tener(Event. COMPLETE, fileRef_complete) ;
> }
>
> private function browseAndUpload( ):void
> {
> //var fileFilter:FileFilt er = 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;
> createdprogressPopu p();
> }
>
> private function fileRef_complete( event:Event) :void
> {
> message.text += " (complete)";
> removeMe();
> }
>
> private function createdprogressPopu p():void{
> progress_win= progress_ popup(PopUpManag er.createPopUp( this,progress_
> popup,true) );
> }
>
> private function removeMe():void {
> PopUpManager. removePopUp( progress_ win);
> }
>
> private function progressHandler( event:ProgressEv ent):void{
> progress_win. uploadProgress. setProgress( event.bytesLoade d,
> 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="browseAndUpl oad();"/>
> </mx:HBox>
> <mx:Label id="message" />
> </mx:FormItem>
>