Name
$object->createattachment -- Create a record attachment
Synopsis
int $object->createattachment
(string name, string title, string mimetype);
Description
Minimum version: Midgard 1.4 (Bifrost)
Is used to create a new, empty attachment to the record represented
by the object.
Returns attachment id if successfull. Returns false on failure.
Method available for: article, element, event, event_member, group,
host, member, page, pageelement, pagelink, person, preference,
sitegroup, snippet, snippetdir, style and topic records.
Example
<?php
$article = mgd_get_article(123); # article with id 123 must exist.
$att = $article->createattachment("test","example","text/html");
if(! $att) {
echo "Failed to create attachment.<br>\n";
echo "Reason: " . mgd_errstr();
} else {
echo "Attachment created. ID is $att.<br>\n";
}
?>