I want to transfer a file, such a form
<form enctype="multipart/form-data"><input type="file" id="logo" @change="LogoUpload($event.target.files)"></form>
The method is not intricate
let form = new FormData(); form.append("file",files[0]); fetch("http://127.0.0.1",{method:'post',headers:{"Content-type":"multipart/form-data"}, body : form});
the problem is that the content is not transmitted
------WebKitFormBoundary9wcnRDYkOAFMdLOo Content-Disposition: form-data; name="file"; filename="a9J63zXOn8s.jpg" Content-Type: image/jpeg ------WebKitFormBoundary9wcnRDYkOAFMdLOo--
I tried it through axios too, ruzeltat is the same.
Content-type
, throughXMLHttpRequest
I do not set this header - Alexander Lonbergfetch
+FormData
also withoutContent-type
- Alexander Lonberg