You need to use ftp_ssl_connect()
function instead of ftp_connect()
because server is using Explicit TLS/SSL
Try this:
$ftp_conn = ftp_ssl_connect($ftp_server)
or die("Could not connect to $ftp_server");
If you are working on localhost
you may encounter error saying
ftp_put(): I won't open a connection to 192...* something..
Then you have to use the ftp_pasv
function.
As of docs:
In passive mode, data connections are initiated by the client, rather than by the server. It may be needed if the client is behind firewall.
In your case yes you need to use it you are using Explicit TLS/SSL just before your loop add this:
ftp_pasv($ftp_conn, true);
Also set your path public_html/img/
to /img/
or whatever directory exists:
$ftp_upload_path = "/img/";