codelv / enaml-web

Build interactive websites with enaml
https://codelv.com/projects/enaml-web/
MIT License
99 stars 17 forks source link

How to implement a file upload button? #28

Closed danieljfarrell closed 3 years ago

danieljfarrell commented 3 years ago

I'm interested in a very simple page that just provided an upload button.

If this was desktop Enaml I guess I would follow these steps:

  1. Window with a button
  2. On button click open a FileDialog widget
  3. Get the local file path when the widget closes
  4. Use Python's file to get the bytes and then "do stuff" with bytes.

Are there similar widgets in Enable-Web? How might you go about doing this?

frmdstryr commented 3 years ago

Use enaml-web to render a page with a file input and implement a handler to save it on the server (eg https://github.com/tornadoweb/tornado/blob/master/demos/file_upload/file_receiver.py)

danieljfarrell commented 3 years ago

Really that easy! Thanks so much!