×
Menu
Index

4.1.22. document

 
Adding documents to your online application has never been easier with BOA. Your user can upload new documents, or existing documents can be reviewed.
 
Adding a document to the system with simple drag and drop, or by selecting.
 
Reviewing an existing document. PDF will be loaded and opened when clicking on it.
 
{
"display": "Bestand:",
"tooltip": "",
"fieldname": "document",
"length": 0,
"inputtype": "document",
"block": 1,
"newline": true,
"labelwidth": 3,
"fieldwidth": 6,
"fieldheight": 2
}
 
  • inputtype: document to upload or to display all kind of documents.
  • fieldwidth and fieldheight defines the size of the canvas provided for it.
 
 
When selecting a file to download and to open, BOA will send the name of the file to the endpoint download. This is a fixed endpoint which can't be changed! There will be send a GET to download the file.
 
The content of the file must be send as a base64 encoded string. You need to define the Content-Type in the header.
 
Different filetypes samples.
 
case cExtentie == ".txt"
     cfileType := "text/plain"
case cExtentie == ".pdf"
     cfileType := "application/pdf"
case cExtentie ==  ".doc"
     cfileType := "application/vnd.ms-word"
case cExtentie ==  ".docx"
     cfileType :="application/vnd.ms-word"
case cExtentie ==  ".xls"
     cfileType := "application/vnd.ms-excel"
case cExtentie == ".png"
     cfileType := "image/png"
case cExtentie ==  ".jpg"
     cfileType := "image/jpeg"
case cExtentie ==  ".jpeg"
     cfileType := "image/jpeg"
case cExtentie ==  ".gif"
     cfileType := "image/gif"
case cExtentie ==  ".csv"
     cfileType := "text/csv"
...
 
setheader('Content-Type', cfiletype)
setheader('Content-Disposition', "attachment; filename=" + cFilename)
setheader('Content-Transfer-Encoding','base64')
content := xbbase64encode(cFileContent)
 
You need to know what the corresponding Content-Type of the document is, this is also called the MIME type. When you search on Google, you will find the corresponding Content-Type to use, see also MIME types.