_server.writeFile()

Availability:

SmartFoxServer PRO 1.2.1

Usage:

_server.writeFile(fileName, fileData, append)

Description:

Writes a text file on disk.
You should provide the file path relative to the folder where the server is located. Default is the Server/ folder

Properties:

fileName   the name of the file to write
fileData   the text data
append   a boolen, if True data will be appended at the end of the file, otherwise the file will be written as new

Returns:

A boolean value. True if file writing was successfull

Example:

/*
* Writes a text file the same folder of the extension.
*/

var text = "This is a very simple text file!"
var ok = _server.writeFile("testFile.txt", text)

if (ok)
	trace("File saved!")
else 
	trace("File write failed!")

See also: