Managed to solve the problem using Uppy!
Used javascript FileReader to convert image to base64, then converted to bytes and to a BlobMedia!
@anvil.js.report_exceptions
def complete(self, result, *args):
print("complete")
for file in result["successful"]:
reader = anvil.js.new(FileReader)
reader.readAsDataURL(file.data)
def on_load_end(*args):
b64_str = reader.result.split(";base64,")[1]
img_data = base64.b64decode(b64_str.encode())
content = BlobMedia(file.type, img_data, file.name)
anvil.server.call('upload', content)
reader.onloadend = on_load_end