When I select small files there is no problem. But for big files larger than around 1MB I get Failed to load resource: net::ERR_CONNECTION_RESET
on Chromium or NetworkError when attempting to fetch resource
on Firefox console and 308
status code on server, whether I use the production server or Gunicorn. Any solution?
JavaScript:
let data = new FormData();
data.append("file", inputFile.files[0]);
let response = await fetch("/upload?key=value", {method: "PUT", body: data});
Python:
@app.put('/upload/')
def upload_file():
key = request.args['key']
file = request.files['file']
print(key)
print(file)
return ''
EDIT: I found the problem. The problem is the query string. The following codes work. Now I want to know how can I pass the query string using PUT or POST method to Flask?
New JavaScript:
let data = new FormData();
data.append("file", inputFile.files[0]);
let response = await fetch("/upload/", {method: "PUT", body: data});
New Python:
@app.put('/upload/')
def upload_file():
file = request.files['file']
print(file)
return ''