INSERT a file into a bytea datatype

Forum related to PostgreSQL

Moderators: gto, cipto_kh, EgonHugeist, olehs

Post Reply
mposthuma
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 28.09.2007, 16:06

INSERT a file into a bytea datatype

Post by mposthuma »

Hi there

I wish to insert a JPG file into a bytea field.

When the file specified is plain TXT, everything works 100%.
However, if I try with JPG, it doesn't the record contains garbage.

Does anybody have an idea, or have sample code I can look at?

Thanks,
Michael
everdaniel
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 16.09.2006, 17:05
Location: Encarnación, Paraguay
Contact:

Post by everdaniel »

hi michael, how do you manage to insert that plain text file into the table? I try several times too to "insert" a file (any file) to a bytea field from delphi but I don't know how exactly? it is possible that you show me some example code?

thanks in advance
varathasiva
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: 28.05.2007, 14:31

Post by varathasiva »

hi michael u can use this code like this
tngimZQCDItemPic.LoadFromFile(OpenPictureDialog1.FileName);
tngimZQ is a ZQuery and ItemPic is a field name
Post Reply