Skip to content

checkAttachment

View as Markdown
function checkAttachment(file, caps?):
| {
kind: "file" | "image";
}
| {
reason: "size" | "type";
};

Defined in: react/src/store.ts:171

Client-side mirror of the server’s upload checks (core AttachmentService.add): extension and canonical Content-Type (classifyAttachment), whether the runtime accepts the kind, and the size limit (ATTACHMENT_LIMITS.maxBytes, the runtime’s maxBytes, and its maxImageBytes for images). Without capabilities only the global limits apply.

Parameter Type
file { name: string; size?: number; type: string; }
file.name string
file.size? number
file.type string
caps? { files: boolean; images: boolean; maxBytes: number; maxImageBytes?: number; }
caps.files boolean
caps.images boolean
caps.maxBytes number
caps.maxImageBytes? number

| { kind: "file" | "image"; } | { reason: "size" | "type"; }