I have some as3 code which successfully opens 2 socket connections to my FTP server. One for commands and one for data. I am using the STOR command to create a file on the FTP server and then sending an encoded jpeg from a byteArray using writeBytes. I then flush the data socket and close it successfully.
All of this appears to be fine apart from the fact that the byteArray is 826 bytes long and I end up with a file which is only 817 bytes on the ftp server which not surprisingly isn't recognised as a jpeg.
Any ideas?
Please do not +1 this answer, nor mark it as correct. I am only posting the comment and answer from @richarddolsson and @Kevin. Go to the comments and add plusses there. I am doing this because this is showing up as "unaswered" in the searches.
@richarddolsson - Configure the transfer to use "binary mode" if such exists (I know it does in some clients). 0x0D 0x0A is a Windows newline sequence (CRLF) and I wouldn't expect that to be in a JPEG header.
@Kevin - The problem was in the mode setting which should have been TYPE I to switch to binary mode and had a typo which defaulted it back to ASCII.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With