diff --git a/covas_mobile/lib/pages/UpdateEventImage.dart b/covas_mobile/lib/pages/UpdateEventImage.dart index 3b39a72..f6a4c7d 100644 --- a/covas_mobile/lib/pages/UpdateEventImage.dart +++ b/covas_mobile/lib/pages/UpdateEventImage.dart @@ -121,21 +121,25 @@ class _UpdateeventImageState extends State 'expiration': '600', 'key': '87a91f7e54516808dda2c4feffbd5287', }; - + print("Post Img"); final urlPost = Uri.parse('https://api.imgbb.com/1/upload') .replace(queryParameters: params); File image = File(widget.imagePath); Uint8List _bytes = await image.readAsBytes(); String _base64String = base64.encode(_bytes); - final req = http.MultipartRequest('POST', url) + final req = http.MultipartRequest('POST', urlPost) ..fields['image'] = _base64String; final stream = await req.send(); final res = await http.Response.fromStream(stream); final status = res.statusCode; + print("code status imgbb ${status}"); if (status == 200) { + var body = json.decode(utf8.decode(res.bodyBytes)); + String imgUrl = body["data"]["url"]; + //String credentials = "${pseudo}:${password}"; //Codec stringToBase64 = utf8.fuse(base64); //String encoded = stringToBase64.encode(credentials); @@ -157,7 +161,8 @@ class _UpdateeventImageState extends State 'organizers': send, 'latitude': '0.0', 'longitude': '0.0', - 'description': description + 'description': description, + "imgUrl": imgUrl })); print(responsePut.statusCode); if ((responsePut.statusCode == 200) ||