Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One more time for storing images at table

Status
Not open for further replies.

aik2

Programmer
Jun 10, 2003
21
Hi all !

I need store images, but I need to do it without file handling functions like lo_import, lo_export, because of LAN and user access rights.
Can I send a file as byte string to server, save there this string as a BLOB ?

Thanks in advance,Ilya
 
Hi,

More to the point do you NEED to do this or just want to do this? Getting the data back out is not the easiest thing to do, more so for web related stuff.

Can't you just store the path/filename in the db instead?

Where are the image sources coming from? File system or I/O stream?


William
Software Engineer
ICQ No. 56047340
 
PostgreSQL is under Linux/or Cygwin.
The users on LAN are storing photos on this server.
Users may not have access to write on server, server may have access to user`s workstations, but it`s different for Linux and Windows ?
 
The answer is: no, you don't need lo_import and lo_export. It is possible to store images and other files using the BYTEA datatype, by just sending the stream from the browser file upload to the variable that will fill that column. If you are doing this with PHP, you should use the pg_escape_bytea() function ( to properly escape the data before storing to that column. BYTEA columns have a maximum record size of 1 GB (or thereabouts, depending on the size of the other columns in the row). BLOB columns can theoretically store much larger files, but I suspect 1 GB is plenty big enough for your typical image file ;-).

-------------------------------------------

My PostgreSQL FAQ --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top