$object->serveattachment

Name

$object->serveattachment -- Serve a record attachment

Synopsis

boolean $object->serveattachment(string name);

Description

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 imediately after.

Returns true 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
  # 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();
?>