set file upllaod via javascript to html input

Solutions on MaxInterview for set file upllaod via javascript to html input by the best coders in the world

showing results for - "set file upllaod via javascript to html input"
Josué
29 Jan 2021
1let photo = document.getElementById("image-file").files[0];  // file from input
2let req = new XMLHttpRequest();
3let formData = new FormData();
4
5formData.append("photo", photo);                                
6req.open("POST", '/upload/image');
7req.send(formData);
8