我使用下面的代码来传输图像,它是工作,除了jpg传输后损坏。是说无效的图像格式并显示模糊的图像。图像损坏后,PHP卷曲传输FTP
我尝试使用普通的PHP没有卷曲,并得到相同的结果。
有谁知道为什么无论我尝试的作品,但破坏了image.jpg的
$curl = curl_init();
$fh = fopen("test.jpg", 'w');
curl_setopt($curl, CURLOPT_URL, "ftp://{$serverInfo['user']}: {$servererInfo['password']}@{$serverInfo['ftp1.server.com']}/{$serverInfo['For_Web/Web Images/Full Size/00-99/file']}");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
fwrite($fh, $result);
fclose($fh);
curl_close($curl);`
尝试'$结果=的file_get_contents(“FTP:// {$ serverInfo [ '用户']}:{$ servererInfo [ '密码']} @ {$ serverInfo [ 'ftp1.server.com'] }/{$ serverInfo ['For_Web/Web Images/Full Size/00-99/file']}“);' – CSharpRU
可能会将'CURLOPT_BINARYTRANSFER'添加到'curl_setopt()' – dnagirl