Skip to content

Commit

Permalink
fix upload on web
Browse files Browse the repository at this point in the history
  • Loading branch information
djade007 committed Nov 16, 2022
1 parent fa25c2a commit a9adb64
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.20.0
- Upload large files in chunks support
- Switch from http package to Dio to support chunk upload

## 0.13.0
- add public_id option

Expand Down
11 changes: 11 additions & 0 deletions lib/src/cloudinary_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,17 @@ class CloudinaryFile {
);
}

if (kIsWeb) {
final res = await Dio().get<List<int>>(
filePath!,
options: Options(responseType: ResponseType.bytes),
);
return MultipartFile.fromBytes(
res.data!,
filename: identifier,
);
}

return MultipartFile.fromFile(
filePath!,
filename: identifier,
Expand Down

0 comments on commit a9adb64

Please sign in to comment.