JavaScript

{dialog.object}phoneGapCreateFile Method

Syntax

{dialog.object}.phoneGapCreateFile(fileName,text,onCreatedFile,onCreateFileERROR,flagAppend);

Arguments

fileName

The name of the file to create.

text

The contents to write to the file.

onCreatedFile

A javascript function that is called if the create file succeeds.

onCreateFileERROR

A javascript function that is called if an error occurs when trying to create the file.

flagAppend

true or false. Flags whether the text should be appended to the file if the file already exists. If true, text will be appended. If false, the existing file is deleted and a new file is created.

Description

Creates a file in the file system of the mobile device.

Discussion

The phoneGapCreateFile method creates a file in the file system of the mobile device. The specified text is written to the file. If the file already exists, the text is appended to the end of the file unless the flagAppend flag is set to false, in which case the existing file is deleted and a new file is created. The method is asynchronous. Calls the onCreatedFile function if the method succeeded. Calls the onCreateFileERROR function is the method failed.

Example

//
{dialog.object}.phoneGapCreateFile(fileName,text,onCreatedFile,onCreateFileERROR,flagAppend);