Invalid argument supplied for foreach php ftp : Would someone mind checking the php code below. https://www.linuxliteos.com/test_info/download.php returns:

 Warning: Invalid argument supplied for foreach() in /home/myhosthere/public_html/test_info/download.php on line 27

    <?
    ini_set('max_execution_time', '18000');
    require_once('config.php');
    $ftp_server = 'ftpipaddresshere';
    $ftp_user_name = 'user';
    $ftp_user_pass = 'password';
    $conn_id = @ftp_connect($ftp_server, 21);
    if(!$conn_id)
    {
    	echo 'Error: Some problem in Connecting to Server!';
    }
    else
    {
    	ftp_pasv($conn_id, true);
    	$login_result = @ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
    	if(!$login_result)
    	{
    		$error_msg = 'Error: Some problem in Connecting to Vendor Server! Cron Job failed on '.date('m/d/Y H:i:s');
    	}
    	else
    	{
    		$arr_files = ftp_rawlist($conn_id, './upload');
    		
    		$arr_list = array();
    		if(count($arr_files))
    		{
    			foreach($arr_files as $str_file)
    			{
    				preg_match('|-rw-r--r--   1 hwdb     hwdb.+ (\d+) ([a-zA-Z]{3} .+\d+ \d+\:\d+) (.*)|', trim($str_file), $arr_details);
    				$arr_list[] = $arr_details[3];
    			}
    		}
    		$arr_final_list = array();
    		foreach($arr_list as $file_name)
    		{
    			if (@ftp_get($conn_id, '/home/myhost/public_html/test_info/upload/'.$file_name, 'upload/'.$file_name, FTP_BINARY)) {
    				$arr_final_list[] = $file_name;
    				//chmod('upload/'.$file_name, 0666);
    				echo "processed";
    				//Now do ftp delete
    				ftp_rename($conn_id, 'upload/'.$file_name, 'processed/'.$file_name);
    			}
    			else
    			{
    				echo "error";
    			}
    		}
    	}
    }
    ?>

config.php

    <?
    $host="localhost";
    $user="dbuser";
    $password="password";
    $database="db";
    $conn = mysqli_connect($host,$user,$password,$database);
    
    ?>

Thank you in advance.