#!/usr/bin/env python # coding: utf-8 # In[6]: from IPython.display import display import fileupload uploader = fileupload.FileUploadWidget() def _handle_upload(change): w = change['owner'] with open(w.filename, 'wb') as f: f.write(w.data) print('Uploaded `{}` ({:.2f} kB)'.format( w.filename, len(w.data) / 2**10)) uploader.observe(_handle_upload, names='data') display(uploader) # In[7]: uploader.filename