Re: Insert images through ASP

From: "Dylan Milks" <DMilks(at)greenridge(dot)ca>
To: "PostgreSQL (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Insert images through ASP
Date: 2004-07-21 13:38:07
Message-ID: 84D4D76946AC2F43AA9BDCD860DC66755DE346@voyager.greenridge-int.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 have to convert the image to a byte stream, then insert. Also, the file path in your example assumes the image is on a UNIX/LINUX/whatever box. 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 the file system, even if it's only temporary.

- Dylan

-----Original Message-----
From: Mike G [mailto:mike(at)thegodshalls(dot)com]
Sent: Wednesday, July 21, 2004 1:25 AM
To: Dylan Milks
Cc: pgsql-general(at)postgresql(dot)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 image within 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 data type, 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(at)thegodshalls(dot)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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Fitzpatrick 2004-07-21 13:48:52 Using SELECT inside a COPY transaction with PHP
Previous Message Oleg Bartunov 2004-07-21 13:34:01 Re: tsearch2, ispell, utf-8 and german special characters