If you want to upload a file through an HTML form, be sure to set the content type to multipart/form-data
. Otherwise it will not work.
If you want to upload a file through the JavaScript fetch
function, be sure NOT to set the content type manually. Otherwise you’ll be stuck for a week. Like me.