我仍在努力理解它。
我可以使用文件输入让用户选择文件(甚至是多个文件):
<form>
<div>
<label>Select file to upload</label>
<input type="file">
</div>
<button type="submit">Convert</button>
</form>
我可以使用<填入您的事件处理程序>
捕获submit
事件。但一旦我这样做了,我该如何使用fetch
发送文件呢?
fetch('/files', {
method: 'post',
// what goes here? What is the "body" for this? content-type header?
}).then(/* whatever */);