# Attachments
URL: /attachments
Learn how to attach files and artifacts collected during test execution to the OpenHTF test record with step-by-step examples.
Attach files collected during execution to the test record.
Hardware tests often generate extra data, such as images, that can't be captured as measurements. OpenHTF allows you to attach these files to the test record.
You can attach binary data or files generated during the test.
Store `binary_data` (bytes or str) under `name`. The MIME type is guessed from `name` unless given.
Read `filename` and attach it. `name` defaults to the file's base name.
Return the `Attachment` (`.data`, `.mimetype`, `.sha1`) during the test.
Attachments are stored in memory until the test ends, then written by output callbacks. `OutputToJSON` inlines them base64-encoded by default (`inline_attachments=True`); pass `inline_attachments=False` to keep the JSON small when attaching images or long logs. The Operator UI lists attachments under each phase and lets the operator download them.
You can attach larger or pre-existing files from disk. The attachment name defaults to the file name and the MIME type is inferred from the extension; both can be overridden.
You can load and access attached files during test execution.