PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$file = 'C:/somefile.txt';----->my local file
$remote_file = 'readme.txt'; -->name by which it should be stored on server
// set up basic connection
$ftp_server="uop.demosites.info";
$ftp_user_name="demosites";
$ftp_user_pass="demosites";
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// 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);
Last edited by Benjamin on Fri May 15, 2009 8:25 am, edited 1 time in total.
Reason:Added [code=php] tags.