IPython file upload widget
Project description
An IPython notebook widget to upload files, using FileReader.
Installation
Install using pip:
pip install -U fileupload
Usage
import io from IPython.display import display import fileupload # Install Javascript fileupload.nbinstall() def _upload(): _upload_widget = fileupload.FileUploadWidget() def _cb(change): decoded = io.StringIO(change['owner'].data.decode('utf-8')) filename = change['owner'].filename print('Uploaded `{}` ({:.2f} kB)'.format( filename, len(decoded.read()) / 2 **10)) _upload_widget.observe(_cb, names='data') display(_upload_widget) _upload()
Base64 data is synced to the data_base64 member, decoded data can be obtained from data. The name of the uploaded file is stored in filename.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Built Distribution
Close
Hashes for fileupload-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49e1d30607121793f22148cb043069be82bf25c5fb3e22316602046dc44cf68a |
|
MD5 | 497734b7dc5cd1706800a46e0e43a15e |
|
BLAKE2-256 | 5934fc7d16796c8f79e3f61d3f0d023b3d1269cef6eb785f98c1db89b5f28d10 |