handling filedrop.js upload gives a 400

59 views
Skip to first unread message

Josh Stratton

unread,
Aug 22, 2015, 2:00:07 PM8/22/15
to django...@googlegroups.com
I'm switching from dropzone.js to filedrop.js.  I'm using the same endpoint as I did for dropzone.js, but I get a 400 error dropping the example code into my html.  I'm not quite sure where to go from here to debug it.  I'm not sure if it's a simple different in how filedrop.js handles encoding or domains compared to dropzone.js.  Any tips for debugging this?  

Here's the request being set out when uploading a png.  

    1. Accept:
      */*
    2. Accept-Encoding:
      gzip, deflate
    3. Accept-Language:
      en-US,en;q=0.8
    4. Connection:
      keep-alive
    5. Content-Length:
      1132236
    6. Content-Type:
      application/octet-stream
    7. Cookie:
      session=eyJ1c2VybmFtZSI6InN0cmF0dG9uYnJhemlsQGdtYWlsLmNvbSJ9.CLpJRw.NsmzkIGOzH-nFFvKTiBWtIwvlFw
    8. Host:
      localhost:5000
    9. Origin:
    10. Referer:
    11. User-Agent:
      Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
    12. X-File-Date:
      Tue, 09 Sep 2014 14:29:26 GMT
    13. X-File-Name:
      Screenshot%20from%202014-09-09%2007%3A29%3A26%20-%201.png
    14. X-File-Size:
      1132236
    15. X-File-Type:
      image/png
    16. X-Requested-With:
      FileDrop-XHR-FileAPI
  1. Request Payload
    1. ‰PNG

  2. And here's the code I had previously in the handler.  

@app.route('/header', methods=['GET', 'POST'])
@requires_auth
def header(forcedName=None):
    print('header')
    if request.method == 'POST':
        file = request.files['file']
        print(file)

Josh Stratton

unread,
Aug 22, 2015, 3:24:26 PM8/22/15
to django...@googlegroups.com
I just realized I pasted a flask snippet from some old code.  Ignore this.  I'll find the new django snippet.  
Reply all
Reply to author
Forward
0 new messages