Uploading files using 'fetch' and 'FormData'

from blog Muffin Man, | ↗ original
Today I learned: To upload files using fetch and FormData (FormData is supported in IE10+.) you must not set Content-Type header. const fileInput = document.querySelector('#your-file-input') ; const formData = new FormData(); formData.append('file', fileInput.files[0]); const options = { method: 'POST', body: formData, // If you add this,...