I am sending data after XMLHttpRequest:
var xmlHttp=new XMLHttpRequest(); xmlHttp.open("POST", domain, true); xmlHttp.setRequestHeader("Content-type","multipart/form-data"); var formData = new FormData(); formData.append("data", data_json_string); xmlHttp.send(formData);
In Python, I get an error if I try to get POST data (or FILES or something else):
MultiPartParserError: Invalid boundary in multipart: None
Could this work? Do I really need to create the body of the form as one line, where I go through the parameters and place the boundary line before and after each? And if so, what should it look like? How to get it from my POST in Python? Or there is an easier way. I look back and do not find much on this.
btw, I use "multipart / form-data" because my string data is really long and this is a faster way to send it. This worked for me when I create a form and submit it, targeting it with an iframe. But here I prefer xmlHttp.
user984003
source share