JavaScript

{dialog.object}phoneGapReadFileURL Method

Syntax

{dialog.object}.phoneGapReadFileURL(filepath, onReadSuccess, onError, startAt, endAt);

Arguments

filepath

local file URL of the desired file. (Tip: Use the .phoneGapGetLocalDirURL() method to get the base path of the file)

onReadSuccess

A javascript function that is called when the file read succeeds.

onError

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

startAt

Defines where to start reading data from the file, if specified.

endAt

Defines where to stop reading data from the file, if specified.

Description

Reads a file.

Example

var onReadSuccess = function(data) {
    alert("File read is a success");
};
var onReadError = function() {
    alert("There was an error trying to read the file");
};
var filepath = {dialog.object}.phoneGapGetLocalDirURL('temp') + 'myfile.txt';
{dialog.object}.phoneGapReadFileURL(filepath,onReadSuccess,onReadError);