What happens is on file upload from an iPhone 6 Safari, the flask server hangs when trying to access request.files. The same iPhone with Chrome works fine. I tried an even bigger file with Chrome, works fine too, so size doesn't seem to be the issue.
@app.route("/upload", methods=["POST"])
def upload():
print request.files
'environ': {'CONTENT_LENGTH': '1496190',
'CONTENT_TYPE': 'multipart/form-data; boundary=----WebKitFormBoundaryaQ6AnBdQhCxhm4b1',
'HTTP_ACCEPT': 'application/json, text/plain, */*',
'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
'HTTP_ACCEPT_LANGUAGE': 'en-us',
'HTTP_CONNECTION': 'keep-alive',
'HTTP_HOST': '192.168.1.155:5000',
'HTTP_ORIGIN': 'http://192.168.1.155:3000',
'HTTP_REFERER': 'http://192.168.1.155:3000/',
'HTTP_USER_AGENT': 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12A365 Safari/600.1.4',
'PATH_INFO': '/upload',
'QUERY_STRING': '',
'REMOTE_ADDR': '192.168.1.137',
'REMOTE_PORT': 52871,
'REQUEST_METHOD': 'POST',
'SCRIPT_NAME': '',
'SERVER_NAME': '0.0.0.0',
'SERVER_PORT': '5000',
'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SOFTWARE': 'Werkzeug/0.10.4',
'werkzeug.request': <Request 'http://192.168.1.155:5000/upload' [POST]>,
'werkzeug.server.shutdown': <function shutdown_server at 0x10bab2938>,
'wsgi.errors': <open file '<stderr>', mode 'w' at 0x10ac741e0>,
'wsgi.input': <socket._fileobject object at 0x10baade50>,
'wsgi.multiprocess': False,
'wsgi.multithread': False,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)},
<form method="POST" enctype="multipart/form-data">
<input type="file" name="thefile" ...
Flask (0.10.1)
Flask-Cors (2.1.0)
What happens is on file upload from an iPhone 6 Safari, the flask server hangs when trying to access request.files. The same iPhone with Chrome works fine. I tried an even bigger file with Chrome, works fine too, so size doesn't seem to be the issue.
For debugging purposes, here's what the environ shows with the Safari client:
And the HTML is classic: