Forum Moderators: coopster

Message Too Old, No Replies

ftp pasv - question

ftp php ftp_pasv

         

jogisarge

9:05 am on Sep 17, 2008 (gmt 0)

10+ Year Member



hello @all,

i have to change my ftp connection in passive mode.
now i am not sure, where i have to place the ftp_pasv statement.
do i have to place it after ftp_connect or after ftp_login, or ...

i hope somebody can help me !

by jogi

PHP_Chimp

9:30 am on Sep 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<?php
$file = 'somefile.txt';
$remote_file = 'readme.txt';

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// turn passive mode on
ftp_pasv($conn_id, true);

// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}

// close the connection
ftp_close($conn_id);
?>


From the ftp_pasv manual page.

So after the connection and login.

[edited by: PHP_Chimp at 9:32 am (utc) on Sep. 17, 2008]