Answers for "set file input value from javascript"

0

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);
Posted by: Guest on February-06-2021
0

set text of file input

<input type="button" id="loadFileXml" value="loadXml" onclick="document.getElementById('file').click();" />
<input type="file" style="display:none;" id="file" name="file"/>
Posted by: Guest on May-22-2021

Code answers related to "set file input value from javascript"

Browse Popular Code Answers by Language