title: Flask file Upload unable to get form data
body: <p>Angular 4
  Flask 1.0.2</p>
  
  <p>Hi all</p>
  
  <p>I am trying to upload a file from Angular by populating a new FormData() object and posting it.  It appears to be posting ok, but I can't get the values from the post from within Flask.</p>
  
  <p>I call this from a button click event:</p>
  
  <pre><code>UploadFile() : void{
      let formModel = new FormData()
      formModel.set('fileName', this.fileName);
      formModel.set('fileData', this.form.get('fileData').value);
  
      this.filesProvider.UploadFile(formModel)
        .subscribe(res =&gt; {
        this.UploadFileProcessed(res, true);
      }
      , (err) =&gt; {
        this.UploadFileProcessed(err, false);
      }
  );
  </code></pre>
  
  <p>...which calls a provider...</p>
  
  <pre><code>UploadFile(formData: FormData) : Observable&lt;Response&gt; {
  
      let headers = new Headers();
      headers.set('Content-Type', null);
      headers.set('Accept', "multipart/form-data");
      headers.set('Authorization', 'Basic ' + btoa(access_token + ":"));
      let requestOptions = new RequestOptions({ headers: headers })
  
      return this.http
      .post(this.globalVarsProvider.apiUrl + "member/uploadFile", formData, requestOptions)
      .map((response: Response) =&gt; response);
  }
  </code></pre>
  
  <p>On the Flask API end I have this:</p>
  
  <pre><code>@app.route('/api/member/uploadFile', methods=['POST'])
  @auth.login_required
  def uploadFile(): 
      print request.form.get('key1')
      return "ok"
  </code></pre>
  
  <p>Running this outputs "None" in the Flask dev server terminal.</p>
  
  <p>If I do <code>print request.get_data()</code> I see all the post data (including the crazy image data stuff).</p>
  
  <p>In Chrome the request looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/bIuNW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bIuNW.png" alt="enter image description here"></a></p>
  
  <p>Any idea what I'm doing wrong please and how I get the data from within Flask?</p>
  
  <p>Thanks!</p>