मैं अभी भी इसके चारों ओर अपना सिर लपेटने की कोशिश कर रहा हूं।
मैं उपयोगकर्ता को फ़ाइल इनपुट के साथ फ़ाइल (या कई भी) का चयन कर सकता हूं:
<form>
<div>
<label>Select file to upload</label>
<input type="file">
</div>
<button type="submit">Convert</button>
</form>
और मैं submitइवेंट का उपयोग करके पकड़ सकता हूं <fill in your event handler here>। लेकिन एक बार जब मैं करता हूं, तो मैं फ़ाइल का उपयोग कैसे करूं fetch?
fetch('/files', {
method: 'post',
// what goes here? What is the "body" for this? content-type header?
}).then(/* whatever */);
Content-Type: multipart/form-dataअनुरोध हैडर घोषित करने की आवश्यकता नहीं है