Upload files using command?

Is there any support for opening the upload files dialog programmatically?
Or is there a command for uploading files? I checked the docs but couldn’t find anything. Is there any alternative?

You can use ipywidgets.widgets.FileUpload() method.

First make sure you have ipywidgets installed, then in your notebook:

import ipywidgets

uploaded_file = ipywidgets.widgets.FileUpload()
uploaded_file

^ This will invoke an upload widget in the notebook output.

uploaded_file.value

^ This will let you use the content, you could save it to the file system with python’s open method to save the data to anywhere you want.

2 Likes