I have tried file upload to server using ftp connection in php and it works fine for html file but in case of images, directories are created but no image will be upload in this directories....i have tried following code please help by correcting it
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
ftp_pasv($conn_id, true);
$my_file = "PATH_TO_FILE";
$fp = fopen($my_file, "r");
if (ftp_fput($conn_id, $my_file , $fp , FTP_BINARY)) {
echo "Successfully uploaded
";
} else {
echo "There was a problem while uploading
";
}
fclose($fp);
ftp_close($conn_id);