I am trying to create a file upload page and I don't know why it is not working. the code that i have is as follows...
<?php
$ftp_server="";
$user_name="";
$password="";
$filename=$_FILES['file_name']['name'];
$directory_name="/public_html/mmbsg/uploads/";
// Here is the FTP section
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $user_name, $password);
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!\n";
echo "Please Notify the Network Administrator!\n";
die;
}
$change=ftp_chdir($conn_id,$directory_name);
if(!$change)
{
echo "The directory couldn't be changed to $directory_name\n";
die;
}
$destination_file = $_FILES['file_name']['name'];
$source_file = $filename;
echo "$destination_file\n";
echo "$source_file\n";
$upload=ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
if (!$upload) {
echo "Ftp upload of data has failed!\n";
echo "Please Notify the Network Administrator!\n";
}
// close the FTP stream
ftp_quit($conn_id);
?>
I removed the server, username, and password but the code finds the server and logs in correctly. the problem is with the actual upload. Does anyone know why this isn't working??
Mike