INTEGRAL DSL Reference Guide
Jump directly to:
::my.app.Write(filename, flags = 0)
This function writes the contents of a file to the INTEGRAL output buffer.
Parameters
filename
A string containing the name (path) of the file to be written to the output buffer. This path is relative to the current working directory.
flags
A bitmask that can be used to customize the behavior of the function.
- If 1st bit is set, the function writes in append mode (i.e. it extends the output buffer); if this bit is not set, then the function writes in overwrite mode (i.e. it overwrites the output buffer).
- Other bits are presently unused.
Return Value
The function returns DV_RET_OK on success and DV_RET_ERR on failure.
- const DV_RET_ERR = 0 — failure
- const DV_RET_OK = 1 — success
Notes
This function can be called multiple times during a web session. Once Write is called, the buffer output mode is set to binary; any subsequent calls to Print or any other function that writes to the output buffer in text mode will fail.
Example 1
::my.app.Write("private/document.pdf");
Example 2
::my.app.SetHeaders("Content-Disposition: attachment; filename=\"document.txt\"\r\n");
::my.app.Write("private/doc_part_1.txt");
::my.app.Write("private/doc_part_2.txt", 1);
::my.app.Write("private/doc_part_3.txt", 1);