Let’s say I have this element on the page:

<input id="image-file" type="file" />

This will create a button that allows the users of the web page to select a file via an OS “File open…” dialog in the browser.

Let’s say the user clicks said button, selects a file in the dialog, then clicks the “Ok” button to close the dialog.

The selected file name is now stored in:

document.getElementById("image-file").value

Now, let’s say that the server handles multi-part POSTs at the URL “/upload/image”.

How do I send the file to “/upload/image”?

Also, how do I listen for notification that the file is finished uploading?

3 Answers
3

Leave a Reply

Your email address will not be published. Required fields are marked *