Browse Source

fix uploading files

master
Inex Code 4 months ago
parent
commit
42fb1e5c0a
  1. 2
      bin/server.dart

2
bin/server.dart

@ -110,7 +110,7 @@ Future<void> _postOnMastodon(reqJson) async { @@ -110,7 +110,7 @@ Future<void> _postOnMastodon(reqJson) async {
for (final photoUrl in photoUrls) {
final resp = await dio.post('$instanceUrl/api/v1/media',
data: dio_lib.FormData.fromMap({'file': File(photoUrl)}),
data: dio_lib.FormData.fromMap({'file': dio_lib.MultipartFile.fromFileSync(photoUrl)}),
options:
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
mediaIds.add(resp.data['id']);

Loading…
Cancel
Save