2

I'm trying to use flowjs/ng-flow to upload images but I'm not getting anything on my backend.

This is the method that is supposed to receive the images in my Flask routes.py:

@app.route('/api/file/upload/', methods = ['GET', 'POST'])
@login_required
def upload_files():
    if request.method == 'GET':
        print "GET"
        print request.args
    else:
        print "POST"
        print request.args

    return "200"

Before finding out that I had to set testChunks:false, I was receiving only a GET request and request.args looked like this:

ImmutableMultiDict([('flowFilename', u'coldplay_butterfly.JPG'), ('flowTotalChunks', u'1'), ('flowRelativePath', u'coldplay_butterfly.JPG'), ('flowTotalSize', u'35338'), ('flowCurrentChunkSize', u'35338'), ('flowIdentifier', u'35338-coldplay_butterflyJPG'), ('flowChunkSize', u'1048576'), ('flowChunkNumber', u'1')])

As for the POST, I get this:

ImmutableMultiDict([])

I have no idea why this is happening. I could also use some help on what to do after I get the array with the files, as in how to properly save the images to a folder inside my project. The only example I found was in PHP, so if someone could clarify how to do that in Python I would really appreciate it!

Thanks!

Larissa Leite
  • 1,358
  • 3
  • 21
  • 36
  • 1
    Did you ever find an answer to this? I'm having exactly the same problem. I disabled testChunks in flow-init but I'm not receiving empty posts – Javier Evans Nov 24 '15 at 21:01
  • Just found it. You need to include a multipart middleware. I got mine working using multer as suggested here: http://stackoverflow.com/a/23439704/2340336 You will need to set `fileParameterName: 'profiles'` in flow/ng-flow and have multer look for a form of that name. – Javier Evans Nov 24 '15 at 21:23

0 Answers0