Is there a way to upload images to a folder using flutter web. All examples I am seeing are using flutter app or mobile. I am getting all kinds of error from Error: Unsupported operation: _Namespace. to: Error: NoSuchMethodError: 'readAsBytesSync' method not found Receiver: "blob:http://localhost:56058/83544616-abe2-4f5c-ac7b-a15a52e4d2e1" Arguments: []
I have been using this flutter function with image picker and a php backend.
Future _uploadimages() async {
var apiUrl = Uri.parse("http://www.redhowler.com/web/db/upload.php");
String bytes = base64Encode(_image.readAsBytesSync());
Map mappedData = {
'name': fileName,
'image': bytes
};
http.Response response = await http.post(apiUrl, body: mappedData);
var data = jsonDecode(response.body);
print(data);
}