Good afternoon, I get base64 encoded images on my server, how can I upload them to FTP cloud via ftp_put?
Now I try to do it like this, but it does not work.
$imsrc = base64_decode($_POST['base64']); $connect = ftp_connect($host); if(!$connect) die("error connect"); $result = ftp_login($connect, $login, $pass); if ($result==false) die("error res"); if (ftp_chdir($connect, $path)) { if (ftp_put($connect, $aname, $imsrc, FTP_BINARY)) echo $aname; else echo "error"; } Throws error.
I tried to add more
$tmp = fopen('php://memory', 'r+'); fputs($tmp, $imsrc); rewind($tmp); ... if (ftp_put($connect, $aname, $tmp, FTP_BINARY)) ... And again error.
Any ideas?