Basic file upload WSGI application (python 2.6.x/2.7.x/3.3.x)
This script brings up a simple_server from python's wsgiref package and runs a really simple WSGI (PEP 3333) application on it. It allows to upload any file using multipart/form-data form content type. When Document Object Model Events, Selectors API, File API, XMLHttpRequest, XMLHttpRequestUpload and FormData are available on the client side then upload process is performed with the usage of client-side logic, allowing user to see the progress. Otherwise simple POST request from within HTML form is performed.
pyfup doesn't depend on any external library - just vanilla python environment is required.
Don't use it in production environment as it has not been reviewed for security issues, however it's handy for ad-hoc file transfers between machines over HTTP protocol.
$ python3 fup.py [WSGIServer/0.2 CPython/3.6.5 pyfup/0.5.5] listening on 0.0.0.0:8000 <192.168.1.13:8000>
No installation is necessary. Just download the latest version.
$ python -m werkzeug.serving [-b HOST:PORT] fup:app
$ gunicorn [-b HOST] --access-logfile - fup:app
$ gunicorn [-b HOST] -k eventlet --access-logfile - fup:app $ gunicorn [-b HOST] -k gevent --access-logfile - fup:app $ gunicorn [-b HOST] -k tornado fup:app
with Twisted Web:
$ twistd -n web [--port PORT] --wsgi fup.app
$ uwsgi --plugin python --http :[PORT] --wsgi-file fup.py --callable app
$ waitress-serve --port [PORT] fup:app
notes on SSL
The easiest way to generate private key and self-signed certificate with OpenSSL:
$ openssl req -newkey rsa:2048 -new -nodes -x509 -days 365 -keyout ssl.key -out ssl.cert
Beware that browser will complain that it can't confirm site's identity and on first connection pyfup can log a request error "SSLV3_ALERT_CERTIFICATE_UNKNOWN" (this behavior is user-agent dependent).
You can support this project via stellar network:
- Payment address: xcmats*keybase.io
- Stellar account ID:
pyfup is released under the BSD 2-Clause license. See the LICENSE for more details.
The script was tested and is known to work with python versions 2.7.2, 2.7.3, 2.7.5, 3.3.0, 3.3.2 and 3.3.3 on linux and windows, but theoretically it should work on all 2.6.x, 2.7.x and 3.3.x.