$object->createattachment

(unknown)

$object->createattachment -- Create a record attachment

Description

int $object->createattachment (string name, string title, string mimetype)

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 successful. Returns FALSE on failure.


<?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";
  }
?>
      

Method available for: article, element, event, event_member, group, host, member, page, pageelement, pagelink, person, preference, sitegroup, snippet, snippetdir, style and topic objects.