#1 2023-03-11 11:29:32

Onur2x
Member
Registered: 2020-09-13
Posts: 4

Uploading images from client to database

Hello
I have a Server-Client program and I cannot save images to the database via the Client.

 TSQLRESIM = class(TOrm)
  private
    fscl: RawUTF8;
    fPicture:RawUTF8;//RawBlob;
    fdel: byte;
  published
    property SCLID  : RawUTF8 read fscl write fscl;
    property PICTURE    : RawUTF8{ RawBlob} read fPicture write fPicture;
    property DELETED: byte read fdelwrite fdel;
  end;


    MAKRSM:= TSQLRESIM.CREATE;

   MAKRSM.SCLID:=x;

         r:=TRawByteStringStream.Create();
         r.LoadFromFile(OPD.FileName);  // OPENDIALOG
         r.Position:=0;
 
         MAKRSM.PICTURE:=StringToUtf8(r.DataString);

        if aClient.orm.Add(MAKRSM, True) = 0 then
        showmessage('OK');

SCLID ok but PICTURE empty. i try rawblob PICTURE empty

Offline

#2 2023-03-11 16:32:08

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: Uploading images from client to database

It is as documented. https://synopse.info/files/html/Synopse … #MNDX_1517
RawBlob are not retrieved nor saved by default within the JSON transmitted to the server.
Use the dedicated BLOB methods, e.g. RetrieveBlobFields.
You can also use ForceBlobTransfert and similar methods.

Offline

#3 2023-03-12 11:52:35

Onur2x
Member
Registered: 2020-09-13
Posts: 4

Re: Uploading images from client to database

Thank you very much. updateblob worked for me

Offline

Board footer

Powered by FluxBB