It is necessary to take pictures through the opendialog on the client machine and by clicking on the button write the file to a folder on the server and the path to the file to the Firebird database. In the absence of due experience I cannot figure out how this can be done. Please tell me which way to look

Is it possible for the database server tools to put a picture not into the database but into the file system?

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky
  • one
    And how will you get these files back? If from the file system, then it is more logical to write the file immediately. Well, in the database just the name of the successfully created file. If you extract from the database, then write to the fig in the file? - Sergey

2 answers 2

Technically, it is realizable.

The first path, "beautiful"

Take C / C ++ / Pascal and write a plug-in to the server - UDF (user defined function), which you should transfer to the BLOB request with data, and she will write it where necessary. Moreover, there is even a piece of the source code.

Pros - from the frontend, everything is done by one request to the database server, no crutches are needed.

Cons - adorable, you need to know the terrible system programming languages.

The second path, "admin"

Pop the data into a temporary table (in BLOB type fields). After that, according to the schedule on the server, they will chase the script, which will gut this table and transfer the BOLOBs to the files

Pros - as in the first method, and also: it is not necessary to write anything special, the built-in tool isql can transfer the blob to a file, you just need to configure everything.

Cons - delay before files appear

  • one
    Not necessarily on schedule. There are events in Firebird. Even some components for the events were right in Delphi. Trigger, trigger, generates an event. The program on the server does not listen to events and rewrites BOLOBs to files immediately. In such a simple way minus the minus delay. - Sergey

You need to look in the direction of creating a text field in the table where you will store the link, and the programming language on which the client is written (file transfer over the network with its help). Because FireBird itself can hardly perform such file manipulations.

You place / copy the file in the necessary network folder, and you write down the link to it in a normal text field in a DB.

Something like this...

For comment:

Using Java, you can transfer files over the network using Socket 's. This mechanism does not require the opening of public access to folders. The server application (if you have a "3x link") can receive a file using the usual network protocol and quietly save the file and link to it. A similar approach can be used when a server issues documents to a client application.

Unfortunately, the format of the resource does not allow to describe in detail what a Socket . Therefore, for clarity, I will give examples here and here .

  • I thought about it, but I do not want to open the folder. (Java language). Maybe on the server side try to implement the server part specifically for receiving documents? - Anna N
  • It is not clear what have programming languages? - Sergey