After uploading files in the previous example into database, now we need to download that files:
Create new Lazarus project to open and browse Photos table in this form:
Download button will prompt you to specify where to download the file.
Write this code in Download button’s OnClick:
procedure TForm1.Button3Click(Sender: TObject); var BlobStream : TStream; M: TFileStream; begin SaveDialog1.FileName:= SQLQuery2.FieldByName('FileName').AsString; if SaveDialog1.Execute then begin BlobStream := SQLQuery2.CreateBlobStream(SQLQuery2.FieldByName('Content'),bmread); M:= TFileStream.Create(SaveDialog1.FileName, fmCreate); BlobStream.Position:= 0; M.CopyFrom(BlobStream, BlobStream.Size); M.Free; BlobStream.Free; end; end;
Pingback: How to upload files into database using Free Pascal/Lazarus « Free Pascal Answers
Is it possible to display a progres indicator which could be important especially for big files?
May be it can be done by using threads. If I had a time I could try it and let you know.
we can do it with one line :(if we use DBImage1, see my message in previous example )
But where is the file name?
Hello, I want to make you a question: What kind of report tool are you using in your software development?
I know that exist a report tool called Fortes4Lazarus, but i would like to see if there is another good tool.
Thanks.
I’m using Fortes report, and I’ve used LazReport, but LazReport has an issues while designing reports under linux.
Make sure to get the latest version of Fortes report