File
my.chooseFileFromDisk
Choose a file from device storage.
Open file picker to select a file from device storage.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Choose a file from device storage.
| Property | Type | Required | Description |
|---|---|---|---|
| success | Function | No | Callback with file path |
| fail | Function | No | Callback on failure |
| complete | Function | No | Callback that always executes |
| Property | Type | Description |
|---|---|---|
| apFilePath | String | The temporary local file path |
| Error Code | Error Message | Remark |
|---|---|---|
| 4 | The JSAPI call is denied | The mini program has no right to call the JSAPI |
| 12 | Errors occur when copying the file | |
| 15 | The user cancels the file selection | |
| 16 | The user denies the permission to read the storage | Android only |
| 17 | No permission to read the storage | Android only |
| 18 | Choosing large file is not supported |
my.chooseFileFromDisk({
success: (res) => {
console.log('Selected:', res.apFilePath);
}
});