Approach 1: This approach is to use FormData that can upload a file without using any kind of form. The special thing about this is that network methods, such as fetch, can accept a FormData object as a body. It’s encoded and sent out with Content-Type — multipart/form-data.
Approach 2: This approach is to use XMLHTTPRequest that can directly upload the file as the content inside the body of POST request.
Approach 3: This approach is to use simpleUpload plugin.
HTML Code Snippet:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.