Skip to content

Commit bea820a

Browse files
authored
Merge pull request #47 from GarvMaggu/master
Added instructions to upload Media on WordPress using uploadMedia function
2 parents 126ef9a + 636fdf0 commit bea820a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,19 @@ Future<void> deleteComment({@required int id}) async {
272272
}
273273
```
274274

275+
### 16. Upload Media
276+
277+
```dart
278+
uploadMedia(File image) async {
279+
var media = await wordPress.uploadMedia(image).then((m) {
280+
print('Media uploaded successfully: $m');
281+
}).catchError((err) {
282+
print('Failed to upload Media: $err');
283+
});
284+
int mediaID = media['id'];
285+
}
286+
```
287+
275288
## Future Work
276289

277290
1. Implementing OAuth 2.0 authentication.
@@ -281,3 +294,4 @@ Future<void> deleteComment({@required int id}) async {
281294
- [Sachin Ganesh](https://github.com/SachinGanesh)
282295
- [Harm-Jan Roskam](https://github.com/harmjanr)
283296
- [Yahya Makarim](https://github.com/ymakarim)
297+
- [Garv Maggu](https://github.com/GarvMaggu)

0 commit comments

Comments
 (0)