How to store a file in the database with Grails

前端 未结 5 823
鱼传尺愫
鱼传尺愫 2021-01-12 23:55

I need to store a file in the database using Grails. So, do you know how I can do that? Which data type should I use in the domain class (byte[] might be a solution)?

5条回答
  •  暖寄归人
    2021-01-13 00:16

    See Chapter on Uploading Files in the Grails User Guide. It is also possible to use a java.sql.Blob as type for the binary content (which would be preferable when dealing with huge files).

提交回复
热议问题