Uses Data.dbxJsonCommon;
服务端
function UpPicture(j:TJsonArray):boolean;
var
T:TDBXJsonTools;
S:TMemoryStream;
begin
Result:=False;
T:=TDBXJsonTools.create;
S:=TMemoryStream.create;
try
s:=T.JsonTOStream(j) as TmemoryStream;
S.savetoFile('d:\abc.rar);
Result:=True;
finally
FreeAndNil(T);
FreeAndNil(S);
end;
end;
客户端
var
ServerClient:TServerMethod1Client;
J:TjsonArray;
M:TMemoryStream;
T:TDbxJSONTOOLS:
begin
try
ServerClent:=TServerMethod1Client.Crate(Con1.DbxConnection);
t:=TdbxJsonTools.create;
M:=TmemoryStream.crate;
M.loadFormFile('d:\abcd.rar');
j:=T.StreamTOJson(M,0,M.size);
if ServerClent.UpPicture(j) then
Showmessage('图片通过jsonStream上传成功!');
finally
FreeandNil(M);
FreeandNil(Y);
end;
end;