Base: how can I store a general file in a MySQL BLOB?

Inspired by my recent success with entering images into a MySQL BLOB, I am wondering if it is possible to enter a more general file in the same way. I have done this a long time ago, with a Java EE application running on a Glassfish server, but I would like to do this in Libreoffice Base.

The background is that I want to have a proper database of documents, that is faster to search, and which allows me to put constraints on how files are stored. What I found in the past is that it is easy to upload a file, but when you retrieve it, you need to know what kind of data you retrieve, so you can decide whether to show it as a picture or perhaps load it into an external viewer; as I recall, I determined (and save) the mime type on upload and used to to decide how to view it on retrieval.

However, I am a complete beginner with Base, so I don’t know if something like this is possible, or where to start.