Skip to main content

How to get the article's file/blob attribute


$fieldset = new mxFieldset();
$fieldset->getBy( array( 'frmid' => $formsetid, 'column' => 'attachment1'));
if( 0 == $fieldset->id) {
  echo 'error: ' . $fieldset->getLastErrorMessage();
  return;
}

$blob = $article->getBlobData( $fieldset, true);
if( $blob && 0 id ) {
  $blob->contenttype data size filename <==== The original file name when being uploaded.
}

Comments

Popular posts from this blog

To list program/subchannel under a channel

--php opening-- //get all program/sub-channel function getAllProgramsUnderThisChannel($channelCodeOrID) { $ids = array(); $channel = new mxChannel; $channel->getBy(array('id' => $channelCodeOrID, 'code' => array($channelCodeOrID, '=', 'OR'))); $programs = $channel->getAllPrograms(); foreach($programs as $program) { $ids[] = $program->code; } $subchannels = $channel->getAllChildChannels(); foreach($subchannels as $subchannel) { $tids = $this->getAllProgramsUnderThisChannel($subchannel->id); $pids = array_merge($ids, $tids); $ids = $pids; } return $ids; } --php closing--

[MXAE] How to DELETE a record

Delete a record using MXAE-API function deleteOneRecord($programCodeOrID, $recId) { $delete = false; $program = new mxProgram; $program->getBy(array('id' => $programCodeOrID, 'code' => array($programCodeOrID, '=', 'OR'))); $ac = $program->getArticle($recId); $delete = $ac->del(); //echo $ac->client; return $delete; }