Re: [C#] File Upload to PostgreSQL

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: drunken <manuzi1(at)hotmail(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [C#] File Upload to PostgreSQL
Date: 2015-07-01 12:17:48
Message-ID: CAKFQuwZdn74KPJJUX1bNmomSr6zebufgExHCFZseVnupqiMf2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wednesday, July 1, 2015, drunken <manuzi1(at)hotmail(dot)com> wrote:

> Hello,
>
> I am Marc from GB.
>
> I have a problem, i cannot upload a file to my PostgreSQL Database.
>
> I don't find the command what I have to use.
> I have tried:
>
> fileUpload.PostedFile.SaveAs(....)
>
> Lets say I have the DB on the Server on 8.8.8.8 the DB is called "test" and
> the table "upload" has an ID, name, timeupload and file.
> The file is a bytea type. Is this correct?
> How is the path called?
>
> Best Regards
>
>
With bytea you read the content of the file into memory using whatever
language you program in and then "insert into upload (file) values (?);"
and pass in the content via whatever parameter methods your language uses.

Your language API may provide for attaching an input stream for the
parameter.

David J.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message John Sherwood 2015-07-02 10:52:13 PGSQL-Performance mailing list
Previous Message drunken 2015-07-01 08:10:50 [C#] File Upload to PostgreSQL