Reputation: 5419
I have a web form (see dummy example below), it's printed by an agent.
When form is submitted it's processed by an agent (LS).
I do not know how to retrieve files/attachments, that is my problem.
<form name="profile" method="POST" action=".../postAgentName?openagent">
<input name="title"/>
<input name="price"/>
...
<input type="file" name="files" multiple>
</form>
Attachments are not part of DocumentContext as far as I see but only file-names. I kind of suspect files could be temporary uploaded to Domino within request somewhere but really I'm not sure?
Is it possible to get attachments using LotusScript from "files" controller within agent written in LS? Can somebody point me in right direction? or maybe give a tip what should I do?
Thanks a lot.
Upvotes: 2
Views: 749
Reputation: 1356
To accept files as part of form submission, you have to set the form 'enctype' attribute to handle files:
<form method="post" enctype="multipart/form-data" action="/x.nsf/x?CreateDocument" name="_fmForm">
Files attached using 'file upload control' (FUC) in Domino will be attached to the document and are accessible via attachment type embedded objects as part of the web-query-save event.
(Note: Generating your own form with a file-upload to Domino is tricky).
Upvotes: 0
Reputation: 5419
I have built my own solution
<form name="formName" method="post" action="agentName?openagent"> <input name="title" value="xxx"> <input type="file" name="files" multiple onchange="toBase64()"> </form>
var reader = new FileReader();
Call stream.WriteText(base64File)
Call item.SetContentFromText(stream, contentType, ENC_BASE64)
See details here (could not format properly here): https://dpastov.blogspot.com/2021/01/how-to-post-attachments-using-form-to.html
Upvotes: 1