Jump to content

Ken Lewis

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Ken Lewis

  1. I only pasted the main part of the code, the part of the code you mentioned is actually there. Design page: Run page: When I click btn1: And when I click btn2: Source Code: procedure TSysParamFrm.btn1Click(Sender: TObject); var tmpStream : TMemoryStream; begin tmpStream:=TMemorystream.Create; try with qryGetImage do begin Close; Open; if not IsEmpty then begin TBlobField(FieldByName('li_image')).SaveToStream(tmpStream); tmpStream.Position :=0; UniCanvas1.Color := clWhite; UniCanvas1.Clear; uniCanvas1.LoadFromStream(tmpStream); end; Close; end; finally FreeAndNil(tmpStream); end; end; procedure TSysParamFrm.btn2Click(Sender: TObject); var tmpStream : TMemoryStream; begin tmpStream:=TMemorystream.Create; try with qryGetImage do begin Close; Open; if not IsEmpty then begin TBlobField(FieldByName('li_image')).SaveToStream(tmpStream); tmpStream.Position :=0; UniCanvas1.Color := clWhite; UniCanvas1.Clear; tmpStream.SaveToFile(UniServerModule.StartPath + 'images/1.png'); UniCanvas1.LoadFromFile(UniServerModule.StartPath + 'images/1.png'); end; Close; end; finally FreeAndNil(tmpStream); end; end;
  2. The file type maybe *.jpg, *.png, or other image types. In this example, I saved .png file in blob.
  3. UniGUI 1555 var tmpStream : TMemoryStream; begin ...... TBlobField(FieldByName('li_image')).SaveToStream(tmpStream); tmpStream.Position :=0; UniCanvas1.Color := clWhite; UniCanvas1.Clear; uniCanvas1.LoadFromStream(tmpStream); //When I use this ,the picture is not shown; tmpStream.SaveToFile(UniServerModule.StartPath + 'images/1.png'); UniCanvas1.LoadFromFile(UniServerModule.StartPath + 'images/1.png'); //The picture is shown; end;
  4. Sorry, when I use your code, a error messge showed "Error Status=0". I think, I should set a upload folder. But, I don't want to upload any file. And your code is excuted when a file has finished uploading. if the file size is very big, I have to wait for a long time. It is not necessary.
  5. I want a function, just like 'browse' botton. When I select a file from my local machine and I get the full name. I can save this filename to database. I need not upload the file. How can I do this ?
×
×
  • Create New...