If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > Uploading an image (or link to an image) to a postgres table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-01-12, 17:19
RRT RRT is offline
Registered User
 
Join Date: Jan 2010
Posts: 9
Question Uploading an image (or link to an image) to a postgres table

Can anyone give me a basic example of how to upload an image (or link to an image) to a postgres table? I have something similar to this code below, but it isn't working... Any suggestions?

EXAMPLE:
.
.
.
$query = sprintf ("INSERT INTO mytable VALUES ('%s')", pg_escape_string(trim($ImageFile));
.
.
.

Last edited by RRT; 02-01-12 at 17:23. Reason: incomplete question.
Reply With Quote
  #2 (permalink)  
Old 02-07-12, 11:23
futurity futurity is offline
Registered User
 
Join Date: May 2008
Posts: 270
If you are trying to hold the location of an image (such as a file path or a url), then this should simply be a text field.

If you are trying to store the actual image itself, I believe this is what the BYTEA datatype is for. PHP has a dedicated function for escaping binary data.
Reply With Quote
  #3 (permalink)  
Old 02-12-12, 22:35
RRT RRT is offline
Registered User
 
Join Date: Jan 2010
Posts: 9
Thanks, that helped. I have another question related to this same topic, but will post in a new thread. Feel free to join me on that one too.
Reply With Quote
Reply

Tags
image

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On