greetings, i'm trying to upload a file with PHP FTP functions... here's my code below :
<?php
if ( isset($_POST["submit"]) )
{
$file = $_FILES["file"]["name"];
if ( empty($file) )
{
echo "Missing Data!!";
exit;
}
$conn = ftp_connect("FTP-SERVER") or die("Could Not Connect To The FTP Server!!");
$login = ftp_login($conn,"xxx","xxx") or die("Could Not Login To The Current FTP Connection!!");
$upload = ftp_put($conn,"root/htdocs/".$file,$file,FTP_BINARY);
if ( $upload )
{
echo $file . " Was Upload Successfuly!!";
}
else
{
echo "Could Not Upload " . $file;
}
ftp_close($conn);
}
?>
i can connect to the FTP server, and i can login to the current FTP connection, but the problem is that i'm getting : Could Not Upload " . $file
i understand that it's a problem of directories, i doubt in this :
ftp_put($conn,"root/htdocs/".$file,$file,FTP_BINARY); // specially in "root/htdocs/".$file