Thanks for the reply, I tried what you said... but I can't get it to work.
Here's my code:
$ftp_server = '127.0.0.1';
$ftp_user_name = "user";
$ftp_user_pass = "pass";
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}
// upload the file
if (ftp_put($conn_id, $_FILES['userfile']['name'], $_FILES['userfile']['name'], FTP_BINARY)) {
echo "Successfully uploaded $file<br>";
} else {
echo "There was a problem while uploading $file<br>";
}
// close the FTP stream
ftp_close($conn_id);
When I run this I think it gets to the "ftp_put" functions and fail. How can I fix this?