support attachments with Base64-encoded data in the Content attribute of the instance of File class

This commit is contained in:
Michael Becker 2025-09-19 19:08:26 -04:00
parent 153783f7ce
commit 8cd25ef90e

View File

@ -49,10 +49,19 @@
{
$ext = "svg";
}
$content = $oms->getAttributeValue($inst, KnownAttributeGuids::Value);
$path = "/var/mocha/uploads/" . $inst->GlobalIdentifier->__toStringFormat(false, null, null) . "." . $ext;
//echo ("iid: " . $inst->GlobalIdentifier);
if (file_exists($path))
if ($content != null)
{
$contentBytes = base64_decode($content);
header("HTTP/1.1 200 OK");
header("Content-Type: " . $contentType);
header("Content-Length: " . strlen($contentBytes));
echo ($contentBytes);
}
else if (file_exists($path))
{
$fsz = filesize($path);