defnull/bottle — Issue #292: Upload Example in Tutorial Doesn't work
Author: asielb
Created: 2012-03-01 21:42:57+00:00
State: open

The [example in the tutorial for uploads](http://bottlepy.org/docs/dev/tutorial.html#post-form-data-and-file-uploads) doesn't work with the current version of bottle.

Here is a modified example that does work:

```python
from bottle import route, request
@route('/upload', method='POST')
def do_upload():
data = request.files['data']
name = data.name
if name and data.file:
raw = data.file.read() # This is dangerous for big files
filename = data.filename
return "Hello %s! You uploaded %s (%d bytes)." % (name, filename, len(raw))
return "You missed a field."
```