UTF8.GetBytes - Not getting the whole of JPG file.
Posted on 2006-11-20
I'm trying to upload a JPG file to a FTP server. Here is a snippet:
Dim sourceStream As New StreamReader(sImageURL) ' <-- eg C:\Test.jpg ( about 220KB in size)
Dim fileContents() As Byte = UTF8.GetBytes(sourceStream.ReadToEnd())
oFTPRequest.ContentLength = fileContents.Length ' <-- Length is about 123KB????
Why is UTF8.GetBytes not returning the whole of the JPG file? I've checked the file and it's not corrupt or damaged, it's 220KB no problem. So why should the GetBytes method have an issue with the file?
Should I be using another technique for getting the bytes of a JPG file?