angularjs+python(Flask) file upload to server
<p>I am developing a web app using angular, python and Flask. 
In my app there is a form where the user need to enter some data and to upload his photo.
I want to implement the file upload to the server using angular.
I saw that I need to use the FormData() and to bind the data from the HTML to angular using "watch".
The javascript part is clear.
I don't understand how can I get the data from the Python side.</p>

<p>This is my HTML - </p>

<pre><code>&lt;form  enctype="multipart/form-data" ng-submit="submitGuideDetailsForm()"&gt;
  &lt;div class="form-group"&gt;
    &lt;label for="usr"&gt;Add your photo:&lt;/label&gt;
    &lt;input type='file' class="form-control" name='file' onchange="angular.element(this).scope().uploadFile(this.files)"&gt;
  &lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>This is my angular - </p>

<pre><code> $scope.uploadFile = function(files) {
            $scope.file = new FormData();
            $scope.file.append("file", files[0]);
        };
 $scope.submitGuideDetailsForm= function() {
     $http.post('/uploadFile', $scope.file, {
           headers: {'Content-Type': undefined },
           transformRequest: angular.identity
          }).success(function(results) 
           {   
              $log.log('success load file')
           }).error(function(error) 
           {
              $log.log('error load file!!!!!')
              $log.log(error);
           });
       };
</code></pre>

<p>I want to get the file on the server side, using python and flask -</p>

<pre><code>@app.route('/uploadFile', methods=['POST'])
def uploadFile():
  json_data = request.json
  print(json_data)
  status = 'success'
  return jsonify({'result': status})
</code></pre>

<p>I don't know how to get the data from the 'request' object.
<code>request.json</code> does not work.</p>

<p>Please advice me what am I doing wrong.
How can I get the data from the 'request' object?
Do I need to encode the data to a file?
How do I send the data back to client? Do I need to encode it back?
I did not find a full example using angular and python/flask uploading a file to server, saving it and than downloading it to the client.
Thanks a lot,
Dina</p>