I have a script written in php which basically uploads images to a server. I'm uploading this script onto my server using an ftp account credentials. However when I try to access it, it gives me login error. Here's the error log:
[09-Apr-2014 19:00:01 Asia/Kolkata] PHP Warning: ftp_login(): Sorry, cleartext sessions are not accepted on this server. in /home/gameeon/public_html/jts/local_upload.php on line 8 [09-Apr-2014 19:01:33 Asia/Kolkata] PHP Warning: ftp_login(): Sorry, cleartext sessions are not accepted on this server. in /home/gameeon/public_html/jts/local_upload.php on line 8 [09-Apr-2014 19:01:55 Asia/Kolkata] PHP Warning: ftp_login(): Sorry, cleartext sessions are not accepted on this server. in /home/gameeon/public_html/jts/local_upload.php on line 8 [09-Apr-2014 19:02:21 Asia/Kolkata] PHP Warning: ftp_login(): Sorry, cleartext sessions are not accepted on this server. in /home/gameeon/public_html/jts/local_upload.php on line 8 [09-Apr-2014 19:03:59 Asia/Kolkata] PHP Warning: ftp_login(): Sorry, cleartext sessions are not accepted on this server. in /home/gameeon/public_html/jts/local_upload.php on line 8
My code is as follows:
<?php
// connect and login to FTP server
$ftp_server = "ftp.gameeon.in"; // enter the ftp host name
$ftp_username = "temp@gameeon.in"; // put your ftp user name
$ftp_userpass = "********"; // put your ftp password
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
/// put the path of your image folder in your remote server i.e:
$ftp_upload_path="public_html/img/";
/// put the path of your image folder in your local machine:
$files = glob("E:/upload_images/*.*");
foreach($files as $fl)
{
$fl_arr = explode("/",$fl);
$cn=count($fl_arr);
$num=$cn-1;
$file=$fl_arr[$num];
// upload file
// $fl = full path of localimages
if (ftp_put($ftp_conn, $ftp_upload_path.$file,$fl, FTP_ASCII))
{
echo "Successfully uploaded $file. <br/>";
}
else
{
echo "Error uploading $file.<br/>";
}
sleep(3); /// pausing the code for 3 secs before next upload
}
// close connection
ftp_close($ftp_conn);
?>
I'm getting an error on this line no. 8 which is:
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);