$object->deleteattachment

Name

$object->deleteattachment -- Delete a record attachment

Synopsis

boolean $object->deleteattachment(string name);

Description

Minimum version: Midgard 1.4 (Bifrost)

Deletes the attachment name to the record represented by the object. Only the owner of the record can delete an attachment to that record.

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
  $person = mgd_get_person(123); # person with id 123 must exist.
                                 # and have an attachment named "photo".
  if($person->deleteattachment("photo")) {
    echo "Deleted attachment \"photo\".<br>\n";
  } else {
    echo "Could not delete attachment.<br>\n";
    echo "Reason: " . mgd_errstr();
  }
?>