Answers for "change choose file input text to upload file js"

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

javascript upload file without input

<style>
 input {
    display: block;
    visibility: hidden;
    width: 0;
    height: 0;
}
</style>

<input type="file" name="somename" size="chars">
<button>Choose File</button>

<script>
$('button').click(function(){
    $('input').click();
});
</script>
Posted by: Guest on January-10-2020

Code answers related to "change choose file input text to upload file js"

Browse Popular Code Answers by Language