1const fileInput = document.querySelector('#your-file-input') ;
2const formData = new FormData();
3
4formData.append('file', fileInput.files[0]);
5
6const options = {
7 method: 'POST',
8 body: formData,
9 // If you add this, upload won't work
10 // headers: {
11 // 'Content-Type': 'multipart/form-data',
12 // }
13};
14
15fetch('your-upload-url', options);
16