2

In database, I have column blob, I need with rest services to send image from device to my database.

In rest services I have parameter PAR_BLOB, I'm try convert Byte to String and get error

Expected Blob got Clob

function BytesToStr(abytes: tbytes): string;
   var
      abyte: byte;
   begin
           for abyte in abytes do
           begin
              Result := result + IntToStr(abyte) + ',';
           end;
           Result := '[' + Copy(Result, 1, Length(Result) - 1) + ']';
   end;
    
    
   ABytes := TFile.ReadAllBytes('/storage/emulated/0/DCIM/Camera/IMG_20210410.jpg');
    
   RESTrequest1.Params.AddItem('PAR_BLOB',BytesToStr(ABytes), pkREQUESTBODY, [], ctAPPLICATION_JSON);

Or any other solution?

Ken White
  • 123,280
  • 14
  • 225
  • 444
babayaro
  • 491
  • 3
  • 15
  • This question is probably the same as yours, read his solution: https://stackoverflow.com/questions/42812071/delphi-send-a-file-as-byte-array-to-a-rest-service and let me know. – fpiette Apr 13 '21 at 05:26
  • @fpiette Tnx, but not solved my problem! – user_odoo Apr 13 '21 at 13:55

0 Answers0