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: Advertisements
To upload files into database, such as photos or any other files type, you need first to create a Blob field in a proper table structure in your favourite database engine. For this example we are using FireBird database table: Create a new Lazarus application and add the following components: TButton, TIBConnection, TSQLTransaction, TSQLQuery, and TOpenDialog:…
To copy files in Free Pascal, you can do it in many ways, one of them is to use TStreamFile‘s CopyFrom method. This example could copy any type of files without changing it’s contents. But destination file information will be changed, like file name, and updated time.
There are many ways to write and read into and from text files in object pascal language. The most simple ways is the old structured method: You can use also an object of TStringList class : Or using object oriented TFileStream class: