Skip to content

Commit

Permalink
Merge pull request ihadeed#1 from hibeekaey/staging
Browse files Browse the repository at this point in the history
Maintain backward compatibility
  • Loading branch information
hibeekaey authored Oct 28, 2018
2 parents 8519920 + bc29e94 commit 31bf60f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"cSpell.words": [
"chooser",
"cordova",
"file",
"plugin"
]
}
49 changes: 33 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
Cordova FileChooser Plugin
# Cordova FileChooser Plugin

Requires Cordova >= 2.8.0

Install with Cordova CLI

$ cordova plugin add https://github.com/don/cordova-filechooser.git
## Install with Cordova CLI

Install with Plugman
```bash
cordova plugin add https://github.com/don/cordova-filechooser.git
```

$ plugman --platform android --project /path/to/project \
--plugin https://github.com/don/cordova-filechooser.git
## Install with Plugman

API
```bash
plugman --platform android --project /path/to/project \
--plugin https://github.com/don/cordova-filechooser.git
```

fileChooser.open(successCallback, failureCallback);
## API

The success callback get the uri of the selected file
```javascript
fileChooser.open(filter, successCallback, failureCallback); // with mime filter

fileChooser.open(function(uri) {
alert(uri);
});

Screenshot
fileChooser.open(successCallback. failureCallback); // without mime filter
```

### Filter (Optional)

```javascript
{ "mime": "application/pdf" } // text/plain, image/png, image/jpeg, audio/wav etc
```

The success callback gets the uri of the selected file

```javascript
fileChooser.open(function(uri) {
alert(uri);
});
```

## Screenshot

![Screenshot](filechooser.png "Screenshot")

Supported Platforms:
## Supported Platforms

- Android
- Windows (UWP)

Expand Down
6 changes: 6 additions & 0 deletions www/fileChooser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module.exports = {
open: function (filter, success, failure) {
if (typeof filter === 'function') {
failure = success;
success = filter;
filter = {};
}

cordova.exec(success, failure, "FileChooser", "open", [ filter ]);
}
};

0 comments on commit 31bf60f

Please sign in to comment.