Hi to all. I try to send image with other data from android application to webservice. I am create REST WebService and create function to receive and write data into database. My android form look like this: After click on "Confirm-Save", I start this code: sRecordContentInJSON is ANSI string sAnimalPhoto is ANSI string = Encrypt (IMG_Photo, "", cryptNone, encodeBASE64) vPassage is Variant vPassage.AnimalID = COMBO_Animal..StoredValue vPassage.ClientID = COMBO_Client..StoredValue vPassage.DatePassage = EDT_Visit_Date vPassage.TimePassage = EDT_Visit_Time vPassage.VisitorID = gnUserID vPassage.VisitReport = EDT_Visit_Report //vPassage.Photo = bufAnimalPhoto vPassage.Photo = sAnimalPhoto sRecordContentInJSON = VariantToJSON (vPassage) maReq is httpRequest maRep is httpResponse maReq.URL = gsIPAdresa + "PassageAdd" maReq..ContentType = "application / json" maReq.Content = sRecordContentInJSON maReq..Method = httpPost myRep = HTTPSend (myReq) IF ErrorOccurred THEN Error (ErrorInfo (errFullDetails)) ELSE IF myDir.DescriptionStatusCode = "OK" THEN ToastDisplay ("Passage is added with success", toastShort, vaMiddle, haCenter) ELSE ToastDisplay (myRep.DescriptionStatusCode + "Problem. Something is wrong", toastShort, vaMiddle, haCenter) END END On REST service my procedure do this: PROCEDURE AddPAssage () sRecordContentInJSON is ANSI string = WebserviceParameter (paramBuffer) vRec is Variant = JSONToVariant (sRecordContentInJSON) HReset (Passage) Passage.AnimalID = vRec.ClientID Passage.ClientID = vRec.ClientID Passage.DatePassage = vRec.DatePassage Passage.TimePassage = vRec.TimePassage Passage.VisitorID = vRec.VisitorID Passage.VisitReport = vRec.VisitReport Passage.Photo = Decrypt (vRec.Photo, "", cryptNone, encodeBASE64) HAdd (Passage) RESULT "OK" Everything is fine except I can not send image. I get empty field "Photo". Please, can you help me to complete this code so I can send images over webservice.
Hi First send data without image, then send the image, you mixed it your self. You better separate the two procedure. If you do it once, let me know. In Older version it was not possible
maReq..ContentType = "application / json" OR maReq..ContentType = "image/jpeg" How to know or get answer from server where to send image. It is database field so I need to know record number to modify/update it. REST service respond with "OK", "403",... Is there possibility to return RecordNumberID. With that I can then send httpPut request to update record with image. Can you write some sample code?
@ LAPIPE2018 Voila. It can be mixed. Here is the answer and solution. For me, work like a charm On Android side code : // sAnimalPhoto is ANSI string = Encrypt (IMG_Photo, "", cryptNone, encodeBASE64) sAnimalPhoto is ANSI string = Encode (fLoadBuffer (IMG_Photo), encodeBASE64URL) o server side, in function: Passage.Photo = Decode (vRec.Photo, encodeBASE64URL) Voila. Work in Debug. I test it also on android smart phone. Work.
There is no any of class. Only variables and procedures. You can see application video from this link: Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!
Sorry. Video is here: Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!
Hi, This will work for small size picture. Test with Video or large size, just to make it better. Kind
Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens! In full format, I send it over webservice in HF C/S database. Work like a charm You can see it above, streched option so it can be viewed. I test it with Samsung S10 - FHD (2288x1080)