I'm trying to upload an image via TIdFtp from Delphi, but some part of the uploaded image is white. The uploaded image is like below:
TransferType
is set to ftBinary
. I think it's not related to image size because I tried with different images with different sizes. Also, I tried with and without compressing JPG too.
The source code is written in this way:
var
JPG: TJPEGImage;
begin
JPG := TJPEGImage.Create;
JPG.Assign(Image1.Picture.Bitmap);
MS := TMemoryStream.Create;
JPG.SaveToStream(MS);
IdFTP1.Connect;
IdFTP1.Put(MS, strFileName);
IdFTP1.Disconnect;
end
Additional information
The log file of upload process is like below:
Stat Connected.
Recv 21/09/2023 20:00:32: 220 ProFTPD Server (ProFTPD) [**********]<EOL>
Sent 21/09/2023 20:00:32: HOST ***********<EOL>
Recv 21/09/2023 20:00:32: 504 ftp.*********: Unknown hostname provided<EOL>
Sent 21/09/2023 20:00:32: USER ********<EOL>
Recv 21/09/2023 20:00:32: 331 Password required for ******<EOL>
Sent 21/09/2023 20:00:32: PASS *********<EOL>
Recv 21/09/2023 20:00:32: 230 User *********** logged in<EOL>
Sent 21/09/2023 20:00:32: FEAT<EOL>
Recv 21/09/2023 20:00:32: 211-Features:<EOL>
Recv 21/09/2023 20:00:32: AUTH TLS<EOL> CCC<EOL> CLNT<EOL> CSID<EOL> EPRT<EOL>
Recv 21/09/2023 20:00:32: EPSV<EOL> HOST<EOL> LANG en-US.UTF-8*<EOL> MDTM<EOL> MFF modify;UNIX.group;UNIX.mode;<EOL> MFMT<EOL> MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.groupname*;UNIX.mode*;UNIX.owner*;UNIX.ownername*;<EOL> PBSZ<EOL> PROT<EOL> RANG STREAM<EOL> REST STREAM<EOL> SIZE<EOL> SSCN<EOL> TVFS<EOL> UTF8<EOL>211 End<EOL>
Sent 21/09/2023 20:00:32: CLNT Indy 10.6.2.5341<EOL>
Recv 21/09/2023 20:00:32: 200 OK<EOL>
Sent 21/09/2023 20:00:32: TYPE I<EOL>
Recv 21/09/2023 20:00:32: 200 Type set to I<EOL>
Sent 21/09/2023 20:00:32: SYST<EOL>
Recv 21/09/2023 20:00:32: 215 UNIX Type: L8<EOL>
Sent 21/09/2023 20:00:32: TYPE I<EOL>
Recv 21/09/2023 20:00:32: 200 Type set to I<EOL>
Sent 21/09/2023 20:00:32: PASV<EOL>
Recv 21/09/2023 20:00:32: 227 Entering Passive Mode *******,246,62).<EOL>
Sent 21/09/2023 20:00:32: STOR ZZP7nY.jpg<EOL>
Recv 21/09/2023 20:00:32: 150 Opening BINARY mode data connection for ZZP7nY.jpg<EOL>
MS.Position=0
asTIdFTP.Put()
will automatically upload aTStream
fromPosition=0
by default. There are optional parameters to change that behavior when needed (ie, for resuming broken uploads, etc)