Hi Everyone,As you can see by the title, I'm trying to use Flex to
uploada file, followed by having PHP FTP the file to the server.I have
been successful at having PHP move the file once Flexuploads it, but
that is using http and the client wants this to bestrictly ftp:Here's
the Flex code:[code] import
flash.net.URLRequest; import flash.net.URLLoader; private var
file:FileReference = new FileReference(); private function init():void {
file.addEventListener(Event.SELECT, selectHandler); } private function
selectHandler(event:Event):void { } private function
browse(event:MouseEvent):void { var filefilter:FileFilter = new
FileFilter("Video Files","*.mov;*.m2v;*.mp4;*.m4v;*.wmv;*.avi;*.swf;");
file.addEventListener(Event.SELECT, fileSelected);
file.addEventListener(Event.COMPLETE, uploadComplete);
file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,uploadDataComplete);
file.addEventListener(IOErrorEvent.IO_ERROR, handleError);
file.browse([filefilter]); } public function
handleError(event:IOErrorEvent):void { status_txt.text = 'ERROR: ' +
event.text + '\n'; } public function fileSelected(event:Event):void { if
(event.currentTarget.size<15800000) { _progressbar.visible=true; file =
FileReference(event.target); txt_file.text = file.name; status_txt.text
= file.name + ' is uploading. \n';
file.addEventListener(ProgressEvent.PROGRESS,progressHandler); var
Form:URLVariables = new URLVariables(); var request:URLRequest = new
URLRequest(); Form.txt_file = txt_file.text; request.data = Form;
request.url = 'ftp_test3.php'; file.upload(request); } else {
mx.controls.Alert.show('Max File Size is: 15MB','File
TooLarge',4,null).clipContent } } public function
uploadComplete(event:Event):void { status_txt.text += 'Upload complete'
+ '\n'; _progressbar.label = ''; _progressbar.visible=false; } private
function progressbarInit():void { _progressbar.visible=false; } private
function progressHandler(event:ProgressEvent):void {
_progressbar.setProgress(50,100); _progressbar.label = 'Uploading '
+Math.round(event.bytesLoaded / 1024) + ' kb of '
+Math.round(event.bytesTotal / 1024) + ' kb ' ; } public function
uploadDataComplete(event:DataEvent):void { // used to send message via
Javascript to let me know thatit actually completed
ExternalInterface.call('sendRequestPost_video', '3'); }
txt_file.text
[/code]And here's the PHP code that moves the file,
which issuccessful:[code][/code]The above code works
fine, but it's not FTP. So, I use the same concept but with ftp, which
...