frol / flask-restplus-server-example

Real-life RESTful server example on Flask-RESTplus
http://flask-restplus-example-server.herokuapp.com/api/v1/
MIT License
1.34k stars 342 forks source link

File upload works as documented, but SPA's also can upload file's via JSON in body #151

Closed acidjunk closed 4 years ago

acidjunk commented 4 years ago

Would it be possible to support this other way of file upload?

I now handle it with this code in my view:

data = request.get_json()
image_mime, image_base64 = data["image_1"]["src"].split(",")
image = base64.b64decode(image_base64)

Swagger specs are not in sync how this endpoint should be used.

I ran into this by using React-Admin file upload which support Drag and drop fileupload: https://marmelab.com/react-admin/DataProviders.html#decorating-your-data-provider-example-of-file-upload

acidjunk commented 4 years ago

sorry wrong repo :(