chooseFile
Description
Selects an image or file from the device’s storage.
Input / Parameter
type
Type of file to choose.
Text
-
Image, Other_Files
Yes
multiple
Whether to select multiple files or not.
Boolean
false
true, false
No
Output
Returns the formatted information.
Object
Callback
callback
The functions to be executed if file is chosen successfully.
The information of the chosen files.
Object
Object format.
{
"extra": undefined,
"input": [
{
"fileCopyUri": null,
"name": "text.txt",
"size": 4,
"type": "text/plain",
"uri": "file:///data/user/0/com.firstproject/cache/text.txt"
}
]
}errorCallback
The functions to be executed if the file is not chosen.
The error message.
Text
Example
In this example, we will use the Device.chooseFile function to get some files data and show it on the console.
Step
Call the function
Device.chooseFileinside the eventflow, and for it'stypeparam select valueImageand for it'smultipleparam select valuetrue.
Call the function
Log.writeinside theDevice.chooseFilefunction callback, and for it'svalueparam change the param type toinput.
Result
Trigger the event.

Select the images.

Check the console.

Last updated