F FormCommander Member Licensed User Longtime User May 23, 2018 #1 Hello, I want to send an image and additional infos to my webserver with a HTTP job. I see that I can do this with PostFile. But here I cannot send the additional infos like with Download2 and the parameters. So I think the best way is to create a xml with the base64 encoded image and send it as file. But converting this way does not work because of a casting error message: Code: Copy Dim cImgSend As Byte = FileToBytes(cPhotoDir,cPhotoFile) Dim b() As Byte = su.EncodeBase64(cImgSend) I would try to put the encoded string in a xml field with XMLBuilder, can this make problems ? I think I must convert back to a string. Or is there a better way to send the data in a http job ? regards Rudolf
Hello, I want to send an image and additional infos to my webserver with a HTTP job. I see that I can do this with PostFile. But here I cannot send the additional infos like with Download2 and the parameters. So I think the best way is to create a xml with the base64 encoded image and send it as file. But converting this way does not work because of a casting error message: Code: Copy Dim cImgSend As Byte = FileToBytes(cPhotoDir,cPhotoFile) Dim b() As Byte = su.EncodeBase64(cImgSend) I would try to put the encoded string in a xml field with XMLBuilder, can this make problems ? I think I must convert back to a string. Or is there a better way to send the data in a http job ? regards Rudolf
DonManfred Expert Licensed User Longtime User May 23, 2018 #2 FormCommander said: Dim b() As Byte = su.EncodeBase64(cImgSend) Click to expand... EncodeBase64 does NOT return a Bytearray. It returns a STRING https://www.b4x.com/android/help/stringutils.html#stringutils_encodebase64 Code: Copy Dim base64string As String = su.EncodeBase64(cImgSend) ' Use base64string in your okhttputils call Upvote 0
FormCommander said: Dim b() As Byte = su.EncodeBase64(cImgSend) Click to expand... EncodeBase64 does NOT return a Bytearray. It returns a STRING https://www.b4x.com/android/help/stringutils.html#stringutils_encodebase64 Code: Copy Dim base64string As String = su.EncodeBase64(cImgSend) ' Use base64string in your okhttputils call
F FormCommander Member Licensed User Longtime User May 23, 2018 #3 Thank you, works now. Have also successful compressed the xml and sent to my webserver. So problem solved. regards Rudolf Upvote 0
Thank you, works now. Have also successful compressed the xml and sent to my webserver. So problem solved. regards Rudolf