I'm still trying to wrap my head around this.
I can suggest the user to select a file (or even several) by entering the file:
<form> <div> <label>Select file to upload</label> <input type="file"> </div> <button type="submit">Convert</button> </form>
And I can catch the submit event using <fill in your event handler here> . But as soon as I do this, how do I send a file using fetch ?
fetch('/files', { method: 'post', // what goes here? What is the "body" for this? content-type header? }).then(/* whatever */);
javascript html5 fetch fetch-api
deitch Mar 17 '16 at 17:31 2016-03-17 17:31
source share