I've managed to encode an image file to base64 using
"convert.ToBase64String"
I know you cannot send the whole string to the server, but you need to send
so many char's at a time which i think is about 76. Is there a way in which
i can do this?
The whole base64 string is in the varible "b64String" but i wish to send 76
chars at a time. I know i can use the substring function but the code i'm using doesn't work, any advance or help?
int
size = b64String.Length;int csize = 0;
string chunky; while (csize < size + 1)
{
chunky = b64String.Substring(csize, 76);
csize = csize + 76;
Console.Write(chunky);
}
Thanks
Si
Nirlep KaurPosted Nov 16, 2005, 7:24 AM
int
size = b64String.Length; int csize = 0; int diff=0; string chunky; while (csize < size ){
if(size-csize>=76){
chunky = b64String.Substring(csize, 76);
csize = csize + 76;
}
else{
diff=size-csize;
chunky = b64String.Substring(csize, diff);
csize = csize + diff;
}
Console.Write(chunky);
}