salim-lachdhaf / dartFTP

dartFTP
MIT License
9 stars 17 forks source link

Can't upload a binary file #36

Open divoneimacedo opened 5 months ago

divoneimacedo commented 5 months ago

Hello people, does anyone have the same problem than me? I cant upload a binary file like .jpg always i tried the file is corrupted in ftp server.

tototo23 commented 4 months ago

I have the same issue and just understood what happened !

On binary data like JPEG, I compared what i sent, and what the server recevied. The server recevied always just few bytes less, even if logs said it's all sent :

I then compared binary and discovered that in the JPEG file there are sometimes the bytes sequences 0x0D0A, that is written on the FTP side as only 0x0A... Cause yeah,in textual mode, it's like replacing CRLF by just LF. But it's not what we want especially in binary files ! So if you search the CRLF occurrences in your JPG files, you'll get the size difference between your original binary file and the corrupted one, that has lost the CR char.

But i don't know if it is a bug from the library itself or an other level. But as it works with other tools, for sure it's a bug somewhere.

samfilholima commented 4 months ago

Hello, I am experiencing the same problem, but specifically with downloads. One thing I've noticed is that for files smaller than 600KB, the process works normally. However, for larger files, some bytes seem to be missing

divoneimacedo commented 4 months ago

Hey Guys, finally my code is working with the FTP its just a configuration on options lib. Now i can send binaries files. here is the code : await ftpClient.setTransferType(TransferType.binary); Thank you all =)

tototo23 commented 4 months ago

Oh @divoneimacedo super nice! Thanks a lot ! It'll help some of us, I didn't see this option, that makes sense !

ismanong commented 3 months ago

@divoneimacedo thank you