Hi all,

I have a site that is running 'duplicated' on an intranet and the outside
world. It runs on a machine within the company network, which also has the
DB (Postgres) running on it. For the outside world there is a duplicate
running on a machine in the DMZ. This machine, for constructing the pages,
accesses the database server on the 'inside' machine to avoid the hassle of
keeping two database servers synchronised. It just has its own PHP scripts.

All fine until now, effectively both sites look and feel the same, except
that the exposed one runs on a different location and no-one will access its
database from outside.

Now we want to give users, both inside and outside, the option to upload and
view files through a webform, and this complicates things...
Usually I **never** put files in BLOB fields, especially not in projects
with heavy database use (tens of thousands ofrecords per table), as backing
up the DB gets virtually impossible because of the size of the archive.

However, as both "identical" servers access different filesystems there
seems to be no way to share the same uploaded archive.

I came up with the following:

- when an image is uploaded, it gets stored (numbered archive, filename
relates to table primary key) in the filesystem of the one webserver that
happens to accept the upload
- simultaneously, it also gets stored in a BLOB
- when somebody, accessing the site through the "other" webserver tries to
access the file, test if it exists. If not, it must be on the other server,
AND in the database. In this case, take the file out of the database, store
it on the filesystem of this second machine, and empty the BLOB. Now the
file exists on boths servers, has generated no more data traffic than
absolutely necessary (bandwith between the internal network and the DMZ is
an issue here; radio connection), and when backing up the table there will
not be a huge BLOB to store.
- basically, records never get deleted, so no need for a double delete
operation.

OK, all fine, but now... how do I go about inserting an image into a BLOB
and how to get it out again. I guess I will have to wait echoing the part of
the page (HTML output) with the image URL until the image has been saved on
the second server as otherwise the browser might start trying to download
the image too soon and display a 'missing image' icon. So when for the first
time displaying an image that was uploaded by a user of the other server the
script may be a bit slow: it will have to receive through the lower-bandwith
connection the image data, save these as a file, and then load the image...

Maybe a bit ignorant and I know I should know how to handle this since a
long time but never dealt with this.

Anyway, any hints are welcome. Now back to Google, "BLOB PHP retrieve"...

Marc



Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to