webServices传送图片

//放入一个HTTPRIO1: THTTPRIO;
var  
ImageArray:array of ImageBean;
byteArray:TByteDynArray;
memStream:Tmemorystream;
 
      SetLength(ImageArray,Num);
memStream:=TMemoryStream.Create;
for i:=0 to Num-1 do
begin
memStream.Clear;
ImageArray[i]:=ImageBean.Create;
ImageArray[i].date:=DateTimeToXSDateTime(DM.qryTemp.fieldbyname('opdate').AsDateTime);

(DM.qryTemp.fieldbyname('zcimage') as TBlobField).SaveToStream(memStream);
SetLength(byteArray,memStream.size);
Move(memStream.memory^,byteArray[0],memStream.size);
ImageArray[i].image:=byteArray;
DM.qryTemp.Next;
end;
memStream.Free;
if (HTTPRIO1 as UploadDataServiceImpl).uploadImages(ImageArray) then
messagebox(0,pchar('Success!'),'Notice',MB_ICONINFORMATION);


ImageBean = class(TRemotable)
private
Fdate: TXSDateTime;
FenterPriseId: Integer;
Fimage: TByteDynArray;
FimageName: WideString;
FmainCode: WideString;
FsubCode: WideString;
Ftype_: WideString;
public
destructor Destroy; override;
published
property date: TXSDateTime read Fdate write Fdate;
property enterPriseId: Integer read FenterPriseId write FenterPriseId;
property image: TByteDynArray read Fimage write Fimage;
property imageName: WideString read FimageName write FimageName;
property mainCode: WideString read FmainCode write FmainCode;
property subCode: WideString read FsubCode write FsubCode;
property type_: WideString read Ftype_ write Ftype_;
end;

 

你可能感兴趣的:(WebServices)