API: Manage Local Files
Check to see if a file currently exists in Kiosk Pro's documents folder, as well as move, rename, or delete files as needed.
In this article
Requirements
- Integration of our JavaScript API into your webpage
- Sample code to run within the app and download for integration into your own project is available here.
- Best practices for working with the JavaScript API are available here.
- App Settings
- Content > JavaScript API > Access JavaScript API = By Import
Triggers via API Functions
Check if File Exists
This function checks whether a file currently exists in Kiosk Pro's Documents folder. If the file is located in a subfolder, the filepath included in the name parameters should be relative to Kiosk Pro's Document root folder (not to the page calling the function).
Format | fileExists(filename,callback); |
Parameters |
|
Callback format | callback(success); |
Callback return values | success - if defined, the files exists. |
Rename or Move File
This function allows you to rename any locally stored file in Kiosk Pro's Documents folder or to move a file to a new location by renaming it with a new filepath. If the file is or will be located in a subfolder, the filepath included in the name parameters should be relative to Kiosk Pro's Document root folder (not to the page calling the function).
Format | kp_FileAPI_renameFile(oldFileName, newFileName, callback) |
Parameters |
|
Callback format | callback(success); |
Callback return values | success - if defined, the file was renamed successfully |
Delete File
This function deletes a file stored locally in Kiosk Pro's Documents folder. If the file is located in a subfolder, the filepath included in the name parameter should be relative to Kiosk Pro's Document root folder (not to the page calling the function).
Format | deleteFile(filename,callback); |
Parameters |
|
Callback format | callback(success); |
Callback return values | success - if defined, the file has been deleted |
Sample Code
- This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.
- To run sample code, set the app's homepage to kioskgroup.com/file-management-api
- To download a .zip of sample code, click here.
Change Log
- Added in version 1.1. Ability to return Base64 string from file added in version 7.5 & deprecated in version 10.0