title: how to connect to mongodb using datepicker and file uploads bootstraps via python
body: <p>I'm new to web development. I have two other user input text boxes and I can easily save them in my database, but I'm not sure how to connect to mongodb using datepicker and file uploads bootstraps via python.</p>
  <p>app.py</p>
  <pre><code>from flask import Flask, render_template, request, jsonify
  
  app = Flask(__name__)
  
  from pymongo import MongoClient
  import certifi
  import gridfs
  
  ca = certifi.where()
  client = MongoClient(&quot;mongodbserver&quot;, tlsCAFile=ca)
  db = client.practice
  
  
  @app.route('/')
  def home():
  
  
      return render_template('index.html')
  
  
  @app.route(&quot;/travel&quot;, methods=[&quot;POST&quot;])
  def web_mars_post():
      print(request.form);
      name_receive = request.form['name_give']
      todo_receive = request.form['todo_give']
      date_receive = request.form['date_give']
      pic_receive = request.form['pic_give']
  
      doc = {
          'name': name_receive,
          'todo': todo_receive,
          'date': date_receive,
          'pic': pic_receive
  
  
      }
      db.travel.insert_one(doc)
      return jsonify({'msg': 'posted!'})
  
  
  
  @app.route(&quot;/mars&quot;, methods=[&quot;GET&quot;])
  def web_mars_get():
      all_users = list(db.mars.find({}, {'_id': False}))
      print(all_countries)
      return jsonify({'orders': all_countries})
  
  if __name__ == '__main__':
      app.run('0.0.0.0', port=5004, debug=True)
  </code></pre>
  <p>index.html (parts of my code)</p>
  <pre><code>
  &lt;form&gt;
          &lt;p&gt;&lt;input type=&quot;date&quot; class='date' width='100' required=&quot;required&quot;&gt;&lt;/p&gt;
      &lt;/form&gt;
  
      &lt;label class=&quot;form-label&quot; for=&quot;pic&quot;&gt;Add a Picture&lt;/label&gt;
      &lt;input type=&quot;file&quot; class=&quot;form-control&quot; id=&quot;pic&quot;/&gt;
  </code></pre>