Top | Previous | Next |
system.file.writeFile |
Description Writes the given data to the file at file path filename. If the file exists, the append argument determines whether or not it is overwritten (the default) or appended to. The data argument can be either a string or an array of bytes (commonly retrieved from a BLOB in a database or read from another file using system.file.readFileAsBytes). Syntax system.file.writeFile(filepath, charData [, append]) Parameters String filepath - The path of the file to write to. String charData - The character content to write to the file. boolean append - If true(1), the file will be appended to if it already exists. If false(0), the file will be overwritten if it exists. The default is false(0). [optional] Returns nothing Scope All system.file.writeFile(filepath, data [, append]) Parameters String filepath - The path of the file to write to. byte[] data - The binary content to write to the file. boolean append - If true(1), the file will be appended to if it already exists. If false(0), the file will be overwritten if it exists. The default is false(0). [optional] Returns nothing Scope All Examples Example 1:
This code would download a BLOB from a database and save it to a file.
resultset = system.db.runQuery("SELECT file_data FROM Files WHERE id=12")
Example 2:
This code would write the contents of a text area to a file.
data = event.source.parent.getComponent("Text Area").text
|