Menu

#26 New binary attachment storage

open
nobody
5
2005-09-29
2005-09-29
Tim Riemann
No

All binary attachments should be stored directly as a
BLOB in the database. The database should save at least
the following contents:

- a unique id
- the MIME type (eg. varchar(64))
- the filename (eg. varchar(255))
- the file (eg. mediumblob)
- the filesize (eg. int(11))

With that it is now possible to use a "streaming page"
which directly sends the output to the user.
E.g. if you know that the attachment is a picture (MIME
type of the attachment), you would write something like
this:

<img src="getFileFromDatabase.php?id=12345"/>

If the MIME type isn't recognized, you would add the
following:

<a href="getFileFromDatabase.php?id=54321">Filename</a>

This can be extended to applets, movies, etc.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB