Fw: working with blobs in a two-server setup
От | Thom Dyson |
---|---|
Тема | Fw: working with blobs in a two-server setup |
Дата | |
Msg-id | OF4B93C0D6.375439BE-ON88256F3A.005FB75C-88256F3A.005FBE03@sybex.com обсуждение исходный текст |
Ответы |
Re: Fw: working with blobs in a two-server setup
|
Список | pgsql-php |
Without a code sample it is pretty hard to offer any specific advice about what you are doing wrong. Here is what I used to load some files. All the $file____ variables are set above this block. $localname = "/home/tdyson/" . $filename; $fp = fopen($localname,"r"); $buffer = fread($fp,filesize($localname)); fclose($fp); $conn = pg_connect("host=myhost.sybex.com port=5432 dbname=my_db user=my_name password=my_password "); pg_query ($conn, "begin"); $oid = pg_lo_create ($conn); $rs = pg_exec($conn,"insert into download_links (file_size, file_name, file_date, product_id, file_version, the_file) values('" . $filesize . "','" . $filename . "','" .$filedate . "','" . $product_id . "','" . $fileversion . "','" . $oid . "')"); // the_file field type must be "oid" $handle = pg_lo_open ($conn, $oid, "w"); pg_lo_write ($handle, $buffer); pg_lo_close ($handle); pg_query ($conn, "commit"); pg_close(); Thom Dyson Director of Information Services Sybex, Inc. pgsql-php-owner@postgresql.org wrote on 10/27/2004 12:42:34 AM: > Hi everyone, > I have a two server setup (both debian stable) with apache and the > PHP engine on server1 and postgresql on server2. My application > should be able to store BLOBs in the database. In a test environment > where everything was running on a single server it was OK (I used > the ADBOdb lo functions there) but now I get into all sorts of > trouble: the database can't find the uploaded file, which makes > sense: it's in /tmp on server1! :-( > Does anyone know how I can handle this or have a pointer to a howto? > Thanks! > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
В списке pgsql-php по дате отправления: