Jump to content

Recommended Posts

Hi, im trying to store and retrieve some small files ( 3k min 15k max ) into a table, but until now only figure out how to store

 

I dont know if this is the best way, but i think it works ( i dont know if it stores the file right into the table, but i can see the table growing )

 

<?php
#bd config
include 'config.php';
#bd call
include 'opendb.php';

$name='node.ndf';

$fp = fopen($name, 'rb');
$content = fread($fp, filesize($name));
$content = pg_escape_string($content);

$sql=("insert into storage values ('$content'::bytea)");
pg_query($sql) or die(pg_last_error());
?>

 

But how do i extract those files from the table?

 

 

PS: the postgresqlField to store is bytea.

 

 

Regards,

Thales Pereira

 

Sorry the double post, but anyone belive this is a better solution? instead storing the file, i could store the information of the file into a field, and when i need it i could extract the data to a local file.

 

 

<?xml version="1.0" encoding="UTF-8"?>

<Values version="2.0">
  <value name="node_type">ConnectionData</value>
  <value name="node_nsName">Adapters:Qry</value>
  <value name="node_pkg">Adapters</value>
  <value name="IRTNODE_VERSION">1</value>
  <value name="IRTNODE_PROPERTY">CwQAAAABBQEEGQBjAG8AbQAuAHcAbQAuAGQAYQB0AGEALgBJAFMATQBlAG0ARABhAHQAYQBJAG0AcABsBBUAYwBvAG4AbgBlAGMAdABpAG8AbgBOAG8AZABlAFYAZQByAHMAaQBvAG4LBAAAAAEEDwBhAGQAYQBwAHQAZQByAFQAeQBwAGUATgBhAG0AZQQLAEoARABCAEMAQQBkAGEAcAB0AGUAcgQZAGMAbwBuAG4AZQBjAHQAaQBvAG4ARgBhAGMAdABvAHIAeQBUAHkAcABlAE4AYQBtAGUENgBjAG8AbQAuAHcAbQAuAGEAZABhAHAAdABlAHIALgB3AG0AagBkAGIAYwAuAGMAbwBuAG4AZQBjAHQAaQBvAG4ALgBKAEQAQgBDAEMAbwBuAG4AZQBjAHQAaQBvAG4ARgBhAGMAdABvAHIAeQQUAGMAbwBuAG4AZQBjAHQAaQBvAG4AUAByAG8AcABlAHIAdABpAGUAcwUBAAIEDwB0AHIAYQBuAHMAYQBjAHQAaQBvAG4AVAB5AHAAZQQOAE4ATwBfAFQAUgBBAE4AUwBBAEMAVABJAE8ATgQPAGQAYQB0AGEAcwBvAHUAcgBjAGUAQwB</value>
</Values>

 

Sugestions?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.