mgd_open_attachment

(Midgard 1.4.2 'Bifrost')

mgd_open_attachment -- Open an attachment for writing

Description

filehandle mgd_open_attachment (int id, string [mode])

Minimum version: Midgard 1.4 (Bifrost)

Opens the attachment with id id for writing. The default open mode when omitted is "w"; this will delete existing content unless you use the second (optional) parameter to specify the open mode; see the mode parameters for fopen(), the default is "w".

Returns a filehandle that can be used with the usual PHP file functions if successful. Returns FALSE on failure. fclose() should be used on the filehandle when done.


<?php
  $filehandle = mgd_open_attachment(13);
  fputs($filehandle, "Writing to an attachment right now...");
  fclose($filehandle);
?>