since ‎18-03-2008
‎10-12-2019
tam2000k2
Level 1
Re: Flex FTP and PHP
Avatar

tam2000k2

tam2000k2
- Adobe LiveCycle
I found the issue and corrected it:I had to remove the "if the form was submitted conditional"[code]if(isset($_POST['SubmitFile'])){[/code]Because the php form would never be submitted via Flexand I changed the following code from txt_file to Filedata[code]$myFile = $_FILES['txt_file']['tmp_name $myFile = $_FILES['Filedata']['tmp_name']; // This will makean array out of the file information that was stored. // $file = $myFile['tmp_name']; //Converts the array into anew string containing the path...

Views

72

Likes

0

Replies

0
Flex FTP and PHP
Avatar

tam2000k2

tam2000k2
- Adobe LiveCycle
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 ...

Views

2.2K

Likes

0

Replies

1
Datagrid from JavaScript from PHP
Avatar

tam2000k2

tam2000k2
- Adobe LiveCycle
Hi Everyone,Let me start by saying that this application worked until ourserver crashed, so I do believe that there is some kind of settingwithin the server that is preventing this from working once again,but our server is set to all default values for now.I basically have a datagrid that is populated via theFABridge component which receives an array from JavaScript, whichreceives the info from a PHP script, which retrieves a result setfrom MySQL.Once more, this worked prior to the server crashi...

Views

205

Likes

0

Replies

0