Hi Dojo community,
I would like to store some attachments within a DOM instance like mentioned in the docs of the DOM helper class.
I was thinking about using FileSelector and DownloadButton to up- and download attachements.
But when looking for a method inside these components, it looks like they are only designed to keep files locally.
How to handle DOM attachments directly in an interactive automation script without using the local disk?
Thanks in advance,
Felix
Hi Felix,
Out of the box you indeed won't be able to upload or download a DOM instance attachment directly. But this should work using some workarounds.
You could read out the file in your script after it's uploaded to the FileSelector, and then upload it as an attachment. Once it's uploaded, you can delete that file.
For downloading, you could create a regular button, not a DownloadButton, once it's pressed, you get the attachment from the DomHelper and save it to a temporary file. You then create a DownloadButton with the config option 'StartDownloadImmediately' set to true, which will start the download immediately. And when the script is closed, some cleanup will have to make sure the temporary file is deleted again.
This will probably be a bit tricky to set all up, let me know if you need some more help or if something is not clear!


You can set the DownloadButton component to immediately start the download without the need of pressing it. So when a user clicks the regular button, you can make the creation of the DownloadButton conditional, so that it only gets created when the user would click the regular button. Which would disable the regular button, and create the DownloadButton which starts the download without the need to click it again.

Thanks, then I'll give it a try
Hi Wouter,
Thanks for the explanation.
It's just as I feared :/
You mentioned creating a regular button and then a separate DownloadButton.
That sounds not very user-friendly.
Any idea how to implement it with just one button to press?
Or do we not even have to press the DownloadButton and it will start automatically after pressing the regular button?