Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010
    Posts
    16

    Question Unanswered: 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 18:23. Reason: incomplete question.

  2. #2
    Join Date
    May 2008
    Posts
    277
    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.

  3. #3
    Join Date
    Jan 2010
    Posts
    16
    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •