# open

## Description

To open any file with a the available local external mobile application available.

## Input / Parameter

| Name  | Description                                                | Input Type | Default | Options | Required |
| ----- | ---------------------------------------------------------- | ---------- | ------- | ------- | -------- |
| file  | The full file path of the file to be opened.               | Text       | -       | -       | Yes      |
| extra | Passed value so that it can be access by extra type value. | Any        | -       | -       | No       |

## Output

N/A

## Callback

### callback

The action performed if this function runs successfully.

| Description             | Output Type |
| ----------------------- | ----------- |
| Successful text massage | Text        |

### errorCallback

The action performed if this function does not run successfully.

| Description               | Output Type |
| ------------------------- | ----------- |
| Returns an error message. | Text        |

## Example

In this example, we will open a file that we chose from a file explorer app using a `fileChooser` function.

```js
Note: This example will only work if the user has a file on their device with the suitable app to open the file.
```

### Steps

1. Drag a button component to a page in the mobile designer, select the component and on the event `press` drag the `fileChooser` function to the event flow.

   ![](/files/9kJGVeaQ6a9wFnI3JGDu)
2. Inside the `fileChooser` function `yes` callback add the `open` function and fill in the parameter with `input` as the param type for `file`.

   ![](/files/ICCIgyhmM8oOtONpfgZz)

### Result

1. Open the installed app on a device and press the button, it should open up the file explorer app so we can choose from there.

   ![](/files/O0xlZjBcBPTqD5PMxhyk)
2. If the file and the suitable apps for opening that file exists, user should be able to see the popup where they can choose which app that they want to use for opening the file. Note: If there's only one app in the user device that's suitable for opening the file or the user had chosen a default app for opening that file type, it will automatically open that app without showing the app chooser popup.

   ![](/files/0StGOfvUa8rIlJHKCaSF)
3. Check the file content using previously selected suitable app.

   ![](/files/no9PW00iHIizNtueAsR8)

## Links

### Related Information

See also:

* Functions
  * [fileChooser](/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/device/filechooser.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/file/open.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
