---
tags: gy
---
# Ilims test protocol attachment
## Goal
When creating a new kind of test (aka a new test template), it should be possible to attach one or several attachments to it, in order to describe the protocol that needs to be followed to carry out the test.
Attachments will be saved in the custom form's couchdb document
Amendments to the main protocol can be made on individual tests or in test presets via a text area field.
## Questions
Is it sufficient or should it also be possible to attach different protocol as a file in an individual sample test?
This would effectively add an attachment to the sample entry itself.
> It would be a nice plus to replace the default test template's protocol with another one on an individual test (John Rasinski)
## Implementation
It won't be possible to delete attachments, since those can be referenced from tests already. It will however be possible to unlink them so that they don't show up in future tests.
As part of the form configuration, user uploads 1 or several files. Those are converted to base64 before they are sent to the database. Be mindful about cleaning the potentially large memory footprint after successful save.
Upload should fail if file name is already taken (updates not allowed, protocols are versioned)
When a new sample test is created, the current linked files are saved along the test. It's important to keep the original link to protocols. The linked files are simply the file names (test already has a form id which allows to link to document id and thus create links to the attachment)
## Limitations
Since we use encode attachments as base64 in the document, we will set the file limit to 10MB