Trying a api to post message and it is working fine:
<cfhttp result="httpResponse" method="post" url="#request.api#Message/post" timeout="30">
<cfhttpparam type="header" name="authorization" value="Basic #ToBase64("#request.username#:#request.password#")#" />
<cfhttpparam type="formfield" name="toEmail" value="#toEmail#"/>
<cfhttpparam type="formfield" name="subject" value="#subject#"/>
<cfhttpparam type="formfield" name="message" value="#message#"/>
<cfhttpparam type="formfield" name="attachment[]" value=""/>
</cfhttp>
Question is this how can I send multiple files as an array attachment[] through Lucee?
response without attachments
{
"status": true,
"message": "Message sent successfully",
"data": {
"id": 324
}
}
This thing is achieved in JavaScript but need to do in Lucee.
fileObjects.map(function(val, index){
formData.append('attachment[]', val.file)
});
Don’t forget to tell us about your stack!
OS: Windows 10 10.0
Java Version: 11.0.6
Tomcat Version: ???
Lucee Version: 5.3.6.61