Skip site navigation (1) Skip section navigation (2)

inserting a file into a database.

From: "Christopher Smith" <csmith(at)gio(dot)com(dot)au>
To: pgsql-novice(at)postgresql(dot)org
Subject: inserting a file into a database.
Date: 2000-09-12 00:23:06
Message-ID: 4A256958.0002266E.00@g000600.gio.com.au (view raw or flat)
Thread:
Lists: pgsql-novice

Hi all,

I'm trying to insert a file into a database from a php form. Here's my sql
statement..

$sql="insert into scripts (id, submittedby, description, script, scriptfile)
values (nextval('scripts_id_seq'), '$loginname', '$description', '$script',
lo_import('$userfile'))";

Here's the error I get..

Warning: PostgresSQL query failed: ERROR: You must have Postgres superuser
privilege to use server-side lo_import(). Anyone can use the client-side
lo_import() provided by libpq. in put-file.php on line 4

OK, I understand the error, no problems. How do I fix it? How do I get around
it? Anyone have a better solution for the sql statement? I don't want to use
libpq, I wanted to be able to do it with php. My webserver runs as "wwwrun", my
postgres superuser is "postgres".

Here's my permission table..

xxxx=# \z
Access permissions for database "xxxx"
     Relation     | Access permissions
------------------+---------------------
 scripts          | {"=","wwwrun=arwR"}
 scripts_id_seq   | {"=","wwwrun=arwR"}

If anyone has some suggestions, please let me know.

Thanks,
Chris.




This email message and any accompanying attachments may contain information that
is confidential and subject to legal privilege.  If you are not the intended
recipient, do not read, use, disseminate, distribute or copy this message or
attachments.  If you have received this message in error, please notify the
sender immediately and delete this message.  Any views expressed in this message
are those of the individual sender, except where the sender expressly, and with
authority, states them to be the views of AMP/GIO.  Before opening any
attachments, please check them for viruses and defects.



Responses

pgsql-novice by date

Next:From: Claus HoumøllerDate: 2000-09-12 00:30:01
Subject: Re: inserting a file into a database.
Previous:From: Michael R. JinksDate: 2000-09-12 00:04:49
Subject: Re: Removing all instances of "NOT NULL" from an entire directory of files

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group