Docly Developers
Function Updated 23 Oct 2026

fileExists(filePath)

Checks whether a file exists in the site, including files the site inherits from the app (publish template) it runs from.

Available in every context. Its counterpart folderExists only exists in API scripts — in a page or template, test a folder with docly.getFolder(path) != null.

Parameters

filePathstringrequired

Absolute path to file to check if exists.

Returns

true if the file exists, otherwise false (also for an empty path).

Example

Normal JavaScript, running in the browser or on the Docly™ server.
if (docly.fileExists("folder/file1")) 
    write("The file exists!");