Thanks again, Paul. I'll take a look at your code tomorrow - I'll see if I can merge the c# into my project if that's ok. Seems like there should be an easier way to transport a file programmatically :-)
>>Yes, they are the same length. The system.convert.frombase64string must not do thesame type of conversion as VFP? It returns byte, which doesn't appear to do anything. Hopefully I don't need to create a .NET dll, call it on my remote side to encode the base64, send the file, then use the .NET decode..? Might be worth a try, but definitely adding overhead upon overhead for a web service...
>>
>
>This sounded familiar so I just dug through some code where I'm doing this kind of conversion. Pass in the string and get back a byte[].
>
>Here's what I'm doing (sorry, C# code)
>
>
> public class HexString
> {
> // From here: http://stackoverflow.com/questions/321370/convert-hex-string-to-byte-array
> public static byte[] StringToByteArray(string hex)
> {
> if (hex.Length % 2 == 1)
> throw new Exception("The binary key cannot have an odd number of digits");
>
> byte[] arr = new byte[hex.Length >> 1];
>
> for (int i = 0; i < hex.Length >> 1; ++i)
> {
> arr[i] = (byte)((GetHexVal(hex[i << 1]) << 4) + (GetHexVal(hex[(i << 1) + 1])));
> }
>
> return arr;
> }
>
> public static int GetHexVal(char hex)
> {
> int val = (int)hex;
> //For uppercase A-F letters:
> return val - (val < 58 ? 48 : 55);
> //For lowercase a-f letters:
> //return val - (val < 58 ? 48 : 87);
> //Or the two combined, but a bit slower:
> //return val - (val < 58 ? 48 : (val < 97 ? 55 : 87));
> }
> }
>
Steve Howie, owner
DaSH Technology
Denver, CO