Skip to content

Commit eaab515

Browse files
authored
Added instructions to upload Media on WordPress
Added instructions on how to use Upload Media Function to upload images to WordPress Media Library
1 parent 7ba21f6 commit eaab515

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+
### 15. 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)