i have been reading most of the tutorials online and all have the source to the 
video to be uploaded and encoded hardcoded. i would like to allow the user to 
browse the his/her system to get the video to upload. anyhow this is my code so 
far but i get errors. please guidance is what am seeking. my code

"videoUploader.mxml" 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" 
creationComplete="init()">
        
        <mx:Script>
                <![CDATA[
                        //////////video upload 
//////////////////////////////////////////////////////////////////////////////
                        private const FILE_UPLOAD_URL:String = 
"../cf/uploadVideo_act.cfm";
                        private var fileRef:FileReference;
        
        
        
                private function init():void
                {
                        fileRef = new FileReference();
                        fileRef.addEventListener(Event.SELECT, fileRef_select); 
                        
                        fileRef.addEventListener(Event.COMPLETE, 
fileRef_complete);
                }

                private function browseAndUpload():void
                {
                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";
                        }       
                        video.text = event.currentTarget.name;
                        }            

                private function fileRef_complete(event:Event):void
                {
                        message.text += " (complete)";
                }
                ]]>
        </mx:Script>
        
        <mx:Form x="348.5" y="193">
                <mx:FormItem label="Video:" direction="horizontal">
                        <mx:TextInput id="video"/>
                        <mx:Button label="Upload" click="browseAndUpload()"/>
                </mx:FormItem>
                <mx:FormItem>
                        <mx:Label text="Label" id="message"/>
                </mx:FormItem>
        </mx:Form>      
</mx:Application>


"uploadVideo_act.cfm(server script)"

<!--- start --->
<cffile action="upload" destination = 
"C:\ColdFusion8\wwwroot\videoUploader\video" nameconflict="overwrite" 
filefield="video" />

<!--- convert the video with FFMPEG --->
<cfexecute name = "C:\ColdFusion8\wwwroot\videoUploader\ffmpeg\ffmpeg.exe" 
arguments = "-i #cffile.SERVERFILE# -s 320x240 -r 15 -b 2000 -ar 44100 -ab 64 
-ac 2 #replace(cffile.SERVERFILE, ".", "")#.flv" outputFile = "C:\" timeout = 
"900">
</cfexecute>
<cfset videoName = "#replace(cffile.SERVERFILE, ".", "")#.flv">
<!--- insert the name of the file into your database --->
<!--- end --->

"error i get when i run the app"

Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error.
        at videoUploader/init()
        at videoUploader/___Application1_creationComplete()
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at mx.core::UIComponent/dispatchEvent()
        at mx.core::UIComponent/set initialized()
        at mx.managers::LayoutManager/doPhasedInstantiation()
        at Function/http://adobe.com/AS3/2006/builtin::apply()
        at mx.core::UIComponent/callLaterDispatcher2()
        at mx.core::UIComponent/callLaterDispatcher()

please help. thanks

Reply via email to