User Tools

Site Tools


Sidebar

file:isfile

isFile()

Function to check whether an object is a File object and whether the file exists on the file system.

Usage

To check whether a resource is a file object:

var file = new File("C:/myfile.txt");
if(isFile(file)) {
   //Do something is this is a file object
}

To check whether the resource is a file object and that the file exists on the file system:

var file = new File("C:/myfile.txt");
if(isFile(file, true)) {
   //Do something is this is a file object and if the file exists on the file system
}

Parameters

Parameter Data type Required Description
file all Yes The object to check. You can parse any kind of object, string or variable to this function
mustexist boolean If set to true the function also checks that the file exists on the file system. Default is false

Return Values

Value Meaning
true The specified object is a file object. When the parameter mustexist is set to true, this return value also means that the file exists on the file system
false The specified object is not a file object. When the parameter mustexist is set to true, this return can also mean that the file does not exist on the file system even when the object is a file object
file/isfile.txt · Last modified: 2017/05/25 10:26 (external edit)