I have to send an octet stream fetched from S3 through an api. I need to change the name of the file received. Does octet stream contain the name of the file ? if yes ,How can I extract the file name from the octet stream ? if no, is there any other way to send an octet stream and attach a file name to it ?
The alternative approach is that I change the name of file before saving it to S3. but I was wondering if it is possible to manipulate the octet stream.
import dw::module::Multipart
output multipart/form-data
---
{
parts: {
part1: Multipart::field({name:"data",value: vars.xmlData, mime:"application/xml"}),
part2: Multipart::field({name:"file",value: vars.docAsBytes,mime:"application/octet-stream"})
}
}
EDIT:
This worked for me
output multipart/form-data
---
{
parts : {
file : {
headers : {
"Content-Disposition" : {
"name": "file",
"filename": "abcdef.jpeg"
},
"Content-Type" : "image/jpeg",
},
content : vars.base64string
}
}