Re: Insert images through ASP - Mailing list pgsql-general

From Dylan Milks
Subject Re: Insert images through ASP
Date
Msg-id 84D4D76946AC2F43AA9BDCD860DC66755DE346@voyager.greenridge-int.ca
Whole thread Raw
In response to Insert images through ASP  ("Dylan Milks" <DMilks@greenridge.ca>)
Responses Re: Insert images through ASP  (Doug McNaught <doug@mcnaught.org>)
List pgsql-general
Thanks for trying. However, the code you gave will only work if the image field is a OID, not BYTEA. With BYTEA I would
haveto convert the image to a byte stream, then insert. Also, the file path in your example assumes the image is on a
UNIX/LINUX/whateverbox. It won't work if the image is on a Windows machine, i.e.:  

insert into img_table values('image name', 'C:/WINNT/Web/Wallpaper/SL600_1.jpg');
OR
insert into img_table values('image name', C:/WINNT/Web/Wallpaper/SL600_1.jpg);

It doesn't like the colon (:) and slashes (/)

What I want to do is upload an image from an ASP page and insert it into a table. I don't want to store the image on
thefile system, even if it's only temporary. 

- Dylan


-----Original Message-----
From: Mike G [mailto:mike@thegodshalls.com]
Sent: Wednesday, July 21, 2004 1:25 AM
To: Dylan Milks
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Insert images through ASP


Ok,
It is late and I am getting sleepy but..

create table large_obj
(
image name text,
the_image bytea
);

insert into large_obj values('the name','/home/auser/file.jpg');

above stores a file path to image.

I can't remember at the moment for sure but maybe removing the '' from around the /home/auser will actually store the
imagewithin the database instead of using the fileserver. 

There was a really good webpage explaining this that I bookmarked somewhere.  IF i could only remember which pc I was
on.....


HTH

 Tue, Jul 20, 2004 at 09:42:36PM -0500, Dylan Milks wrote:
> I'm using VB Script (ASP), ODBC and preferably I'd like to use the BYTEA field. I can get it to work using an OID
datatype, but I'd like to see about BYTEA. 
>
> I'm using Postgres 7.3
>
> Thanks in advance.
>
> - Dylan
>
>         -----Original Message-----
>         From: mike g [mailto:mike@thegodshalls.com]
>         Sent: Fri 7/16/2004 11:07 PM
>         To: Dylan Milks
>         Cc: PostgreSQL (E-mail)
>         Subject: Re: [GENERAL] Insert images through ASP
>
>
>
>         Hi,
>
>         I think you will need to be more specific to what scripting language you
>         are attempting to use, which blob data type is being used in the db(lo
>         or bytea), and possibly the database driver used (odbc / .net)
>         to get a response from the community.
>
>         Mike
>         On Fri, 2004-07-16 at 08:21, Dylan Milks wrote:
>         > I'm just wondering if anyone has ever inserted images into a Postgres
>         > DB through ASP. If so, could you please give me a snippet of code to
>         > show me how to do it. I can't seem to get it working.
>         >
>         > Thanks,
>         > - Dylan Milks
>         >
>         >
>         > ______________________________________________________________________
>         > This communication, including its attachments, if any, is intended
>         > solely for the recipient; it is confidential and may contain personal
>         > or private information, or proprietary and/or privileged material. As
>         > such, any unauthorized use, retention, copying, disclosure or other
>         > distribution of this communication, or the taking of any action in
>         > reliance on its contents
>         > is strictly prohibited. If you have received this communication in
>         > error, please notify us immediately and delete this communication (and
>         > any attachments.)
>         >
>         >
>         >
>
>         ---------------------------(end of broadcast)---------------------------
>         TIP 8: explain analyze is your friend
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

pgsql-general by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: tsearch2, ispell, utf-8 and german special characters
Next
From: Robert Fitzpatrick
Date:
Subject: Using SELECT inside a COPY transaction with PHP