You can do bytea (which stores the image as a bytearray) or Large Object support (lo) which stores the oid reference to the image and stores it in another table.
What language are you using? Check way at the bottom of this page gives an example of storing files in bytea using .NET ADO driver as well as using the LO (Large Object support).
Even if its not the language you use, could provide you with some ideas.
Bytea example Look for "Working with binary data and bytea datatype"
For LO look for "Working with large object support" in the below link
Hope that helps,
From: pgsql-novice-owner(at)postgresql(dot)org on behalf of richard terry
Sent: Thu 8/28/2008 5:26 PM
To: 'PostgreSQL Novice'
Subject: [NOVICE] How to save a image file in a postgres data field.
I want to be able to save an image, say myimage.png, into the database, and
having difficulty with understanding the postgres documentation.
The nearest I can figure is that there is a field called bytea ?? is this the
If so, I wondered if anyone could give me a simple line of sql code which
would demonstrate how to do this.
Regards and thanks in advance.
Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org)
To make changes to your subscription:
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
In response to
pgsql-novice by date
|Next:||From: Dale Seaburg||Date: 2008-08-30 21:49:37|
|Subject: Date Of Entry and Date Of Change|
|Previous:||From: richard terry||Date: 2008-08-28 21:26:06|
|Subject: How to save a image file in a postgres data field.|