Attachments, also known as blobs, can be used to administer and serve out arbitrary data with Midgard. This will typically be used for images, sounds, flash movies, etc. and for files available for download.
Attachments can be connected to any kind of resource, not just articles as with the Midgard file functions, and attachments to page records will be served out directly based on their name.
To prepare your setup for blobserving, create a directory to store the attached file, e.g. /home/httpd/blobs, and make sure the user that apache runs as (e.g. nobody) has read permission for this directory. Write permission is not necesary.
Within this directory, create the directories that the actual files will be stored in by executing:
mkdir `perl -e '@dirs = split(//, "0123456789ABCDEF"); foreach $l1 (@dirs) { print "$l1\n"; foreach $l2 (@dirs) { print "$l1/$l2\n"; } }'` chown -R nobody * chmod -R u+rwx *
In your httpd.conf, specify the blob directory:
MidgardBlobDir /home/httpd/blobs
An attachment record contains information about record attachments.
Fields of an attachment record
The id of the attachment record.
The name of the parent table the attachment belongs to.
The id of the parent record within the table ptable
The score of the attachment.
The name of the attachment.
The title of the attachment.
The location of the attachment.
The mimetype of the attachement.
The sitegroup the attachment belongs to.
The person-id of the author of the attachment.
Date and time the attachment record was created. Format is YYYY-MM-DD HH:mm:ss
Midgard functions like mgd_get_attachment return objects upon success. This section describes the contents of those objects.
The functions listed within the object definition are the object methods that are available for the object. Usage information about thos methods can be found in: Object Methods.
/* Attachment Object Prototype */ Class attachment { var $N; # Only in objects created by calling $object->listattachments. var $id; var $ptable; var $pid; var $score; var $name; var $title; var $location; var $mimetype; var $sitegroup; var $author; var $created; function fetch(); # Only in objects created by calling $object->listattachments. function delete(); function update(); function listparameters(); function parameter(); function searchparameters(); function getsitegroup(); function setsitegroup(); }