Use PostgreSQL large objects (AKA BLOBs) to store your files inside the database