Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

set file upllaod via javascript to html input

let photo = document.getElementById("image-file").files[0];  // file from input
let req = new XMLHttpRequest();
let formData = new FormData();

formData.append("photo", photo);                                
req.open("POST", '/upload/image');
req.send(formData);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #file #upllaod #javascript #html #input
ADD COMMENT
Topic
Name
3+2 =