Why the image is getting corrupted uploaded to the FTP server using PHP?

风流意气都作罢 提交于 2019-11-29 11:23:33
Aleksei Matiushkin

You should set the mode with ftp_put to be FTP_BINARY:

ftp_put($conn_id, $remote_file, $file, FTP_BINARY); 

This is mandatory since ASCII mode checks whether the line endings differ on client/server (your case, since you are likely on windows and the server runs unix) and tries to convert them (\r\n\n). In BINARY mode files are being sent as is.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!