title: multiple routes and function in bottle framework
body: <p>I'm trying to modify already existing code, simply add form to add photos.</p>
  
  <p><strong>python:</strong></p>
  
  <pre><code>@route('/photos/add')
  @jinja_view('add.html')
  @post('/photos/add')
  def upload_func():
      upload = request.files.get('pic')
      name, ext = os.path.splitext(upload.filename)
      if ext not in ('.png', '.jpg', '.jpeg'):
          return "ext is not allowed"
      save_path = "/src/photo_gallery/photos"
      upload.save(save_path)
      return "photo is saved"
  </code></pre>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;form action="/photos/add" method="post"&gt;
      &lt;div align="center"&gt;
          &lt;label&gt;Picture&lt;/label&gt;
          &lt;input type="file" name="pic" required&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;label&gt;Info&lt;/label&gt;
          &lt;input type="text" name="text"&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;input type="submit" value="add"&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>server log:</strong>
  Traceback (most recent call last):
    File "/home/empty/python/bottle/lib/python3.5/site-packages/bottle.py", line 862, in _handle
      return route.call(**args)</p>
  
  <p>File "/home/empty/python/bottle/lib/python3.5/site-packages/bottle.py", line 1740, in wrapper
      rv = callback(*a, **ka)</p>
  
  <p>File "/home/empty/python/bottle/lib/python3.5/site-packages/bottle.py", line 3635, in wrapper
      result = func(*args, **kwargs)</p>
  
  <p>File "/home/empty/python/bottle/src/photo_gallery/app.py", line 50, in upload_func
      name, ext = os.path.splitext(upload.filename)
  AttributeError: 'NoneType' object has no attribute 'filename'
  127.0.0.1 - - [22/Dec/2016 23:20:42] "GET /photos/add HTTP/1.1" 500 751</p>