title: Login and upload file using Python 'flask' app
body: <p>I Have created a flask app which need to upload files to server and also need to take login detail on same html form .</p>
  
  <p>I am able to upload file to destination folder , but credential part is not getting fetched/submit to form and unable to get this in flask app for further processing .</p>
  
  <p>i need to do some operation on this file based on user credentials ( i know credential are plain text ) </p>
  
  <p><strong>Html form :-</strong> </p>
  
  <pre><code>&lt;form action="/import" enctype="multipart/form-data" method="post"&gt;
  
    &lt;p&gt;User name &lt;input name="username" type="text" /&gt;&lt;/p&gt;
  &lt;p&gt;User password: &lt;input name="psw" type="password" /&gt;&lt;/p&gt;
  
  &lt;p&gt;&lt;input name="file" type="file" /&gt; &lt;input type="submit" value="Submit" /&gt;&lt;/p&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Flask Application code :-</strong></p>
  
  <pre><code>    from flask import Flask, render_template, request
      from werkzeug import secure_filename
      app = Flask(__name__)
  
      @app.route('/import')
      def import_form():
         return render_template('import.html')
  
      @app.route('/import', methods = ['GET', 'POST'])
      def import_form():
         if request.method == 'POST':
            username = request.args.get('username')
            psw = request.args.get('psw')
            psw = str(psw)
            username=str(username)
            f = request.files['file']
            f.save(secure_filename(f.filename))
            fname = f.filename
  
            cmd = ('sh myscript.sh -u '+username+' -p '+psw+' -src '+fname)  # command to pass parameter as user name password and file name in directory 
  
            p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
                stdout, stderr = p.communicate()
            return out    
  if __name__ == '__main__':
         app.run(debug = True)
  </code></pre>
  
  <p>output of this come as below ( user name and password value come as blank/none ) </p>
  
  <p><strong>sh myscript.sh -u <em>none</em> -p <em>none</em> -src xyz.file</strong></p>
  
  <p>I want to get user name password and file upload on same page then process this request under a shell script t o return output of it </p>