$object->serveattachment

(unknown)

$object->serveattachment -- Serve a record attachment

Description

boolean $object->serveattachment (string name)

Minimum version: Midgard 1.4 (Bifrost)

Sends the Content-Type header, any other headers specified with Header, and the content of a record attachment. As with any other function that sends headers, the function needs to be called before any other output, and exit() should be called immediately afterwards.

Returns TRUE on success, FALSE on failure.


<?php
  // This code should be in a code-init page element.
  $article = mgd_get_article(123); // article with id 123 must exist.      
  $article->serveattachment("readmore.html");
  exit();
?>

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