PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV Mobile 27 → Send photos from android to php webservice
Send photos from android to php webservice
Iniciado por marcov, set., 05 2022 4:08 PM - 2 respostas
Membro registado
53 mensagems
Publicado em setembro, 05 2022 - 4:08 PM
I am trying to send a photo from android to a webservice, I tried both saving the photo in hfsql, and taking it from the directory
test with paht:
sTipoRic is string
sTest is string =QRY_Photos.Path
sFoto is string = CompleteDir(fCurrentDir()) + sTest
vRequest is Variant
sTipoRic = "Add"

vRequest.Tipo_Ric = sTipoRic
vRequest.Descrizio = "test123"
vRequest.Image = Encrypt(fLoadBuffer(sFoto),"",cryptNone,encodeBASE64NoCR)

cMyRequest is httpRequest
cMyRequest.URL = "http://1xxxxx" // SERVER PRODUZIONE
cMyRequest.ContentType = "application/json"
cMyRequest.Content = VariantToJSON(vRequest)
cMyRequest.Method = httpPost
cMyResponse is httpResponse = HTTPSend(cMyRequest)

test with db

bufFotobuf is Buffer =QRY_Photos.Photo
sFoto is string = Encode(fLoadBuffer(bufFotobuf), encodeBASE64)
Membro registado
53 mensagems
Publicado em setembro, 07 2022 - 4:12 PM
hi,

i solved the problem, it was not the client but the server, for some reason the php base64_decode is not compatible with windev encode
Membro registado
53 mensagems
Publicado em setembro, 07 2022 - 5:50 PM
hi,

I rectify everything works correctly.
before inserting the file into mysql in php:
$ fileName = addslashes ($image);