Doug DeBold
10/06/2025, 2:36 PMvalueAttachment in the answer. This is coming directly from the createAttachment method. Below is some pseudo code for how we are doing photo upload:
// Attachment Input
const attachment = await medplum.createAttachment({
data: blob,
contentType: asset.mimeType || 'application/octet-stream',
filename: asset.fileName || 'attachment',
})
handleValueChange(attachment)
// QuestionnaireFormItem.tsx
case QuestionnaireItemType.attachment:
formComponent = (
<AttachmentInput
defaultValue={defaultValue?.value}
onChange={(newValue) => onChangeAnswer({ valueAttachment: newValue })}
/>
)
break
Which results in this in the answer field for the item:
"answer": [
{
"valueAttachment": {
"contentType": "image/png",
"url": "https://medplum-storage.mydomain.com/<aws-signature>",
"title": "IMG_6374.png"
}
}
]
We are using our own component because this is a react native app, but looking at how the attachment works in @medplum/react this is effectively identical.
So the question is: How should we be saving attachments so that they are visible in the future?
Also, we are self-hosting and I posted a somewhat similar issue last week around invalid reference to the Binary when uploading a bot. I'm kinda wondering if this is a server configuration issue and not a UI issueIan Plunkett
10/08/2025, 7:44 PM// When creating the attachment
const attachment = await medplum.createAttachment({
data: blob,
contentType: asset.mimeType || 'application/octet-stream',
filename: asset.fileName || 'attachment',
});
// Instead of using the attachment directly, create a reference
const attachmentReference = {
contentType: attachment.contentType,
url: `Binary/${attachment.id}`, // Reference to the Binary resource
title: attachment.title,
};
handleValueChange(attachmentReference);Ian Plunkett
10/08/2025, 7:45 PMDoug DeBold
10/09/2025, 4:30 PM