here's a sample but dirty code ive been using for testing..
Code: Select all
// set the ftp settings,
$ftp_server = 'somedomain.com;
$ftp_user_name = 'user';
$ftp_user_pass = '1234';
// set the directory and file settings
$dir = 'D:\'';
$file = 'sample.xml';
$path = $dir . $file;
// make the connection
$fp = fopen($path,"r");
$conn_id = ftp_connect($ftp_server,21);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$ret = ftp_nb_fput($conn_id , $file , $fp , FTP_BINARY);
while($ret == FTP_MOREDATA){
print ftell($fp);
echo "\n";
$ret = ftp_nb_continue($conn_id);
}
if ($ret == FTP_FINISHED) {
echo 'file upload complete';
exit(1);
}
fclose($fp);
Thanks,