title: Python Bottle multiple file upload
body: <p>I wish to upload multiple files to a Bottle server.</p>
  
  <p>Single file upload works well and by modifying the HTML input tag to be "multiple", the browse button allows the selection of multiple files. The upload request handler only loads the last file. How can I get all the files uploaded in one go?</p>
  
  <p>The code I am experimenting with:</p>
  
  <pre><code>    from bottle import route, request, run
  
      import os
  
      @route('/fileselect')
      def fileselect():
          return '''
      &lt;form action="/upload" method="post" enctype="multipart/form-data"&gt;
        Category:      &lt;input type="text" name="category" /&gt;
        Select a file: &lt;input type="file" name="upload" multiple /&gt;
        &lt;input type="submit" value="Start upload" /&gt;
      &lt;/form&gt;
          '''
  
      @route('/upload', method='POST')
      def do_upload():
          category   = request.forms.get('category')
          upload     = request.files.get('upload')
          print dir(upload)
          name, ext = os.path.splitext(upload.filename)
          if ext not in ('.png','.jpg','.jpeg'):
              return 'File extension not allowed.'
  
          #save_path = get_save_path_for_category(category)
          save_path = "/home/user/bottlefiles"
          upload.save(save_path) # appends upload.filename automatically
          return 'OK'
  
      run(host='localhost', port=8080)
  </code></pre>