On 06/08/2011 06:13 PM, Arash pajoohande wrote:
> 1. save .doc documents in bytea columns. and show them with a word
> reader in web page (disadvantage: it needs a proper .doc reader
> installed on user computer)
1a: Convert the .doc files to a standard format like PDF that most
browsers can display. That's what I'd do.
> 2. convert document to html format and store html code as string
> (disadvantage: images will remain in file system)
You could always store images as 'bytea' fields on a subtable.
CREATE TABLE doc (
id serial primary key,
doc_html text,
...
);
CREATE TABLE doc_images (
id serial primary key,
doc_id integer references doc(id),
image_data bytea not null
);
There are advantages and disadvantages to storing files in the database
vs in the file system. It's been discussed to death recently, so see the
mailing list archives.
--
Craig Ringer