Forked from m1r4z/file_upload_using_javascript.js
Created
September 25, 2021 12:24
-
-
Save sahwar/49c49d17232616788fec7a238ac3b49d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let temp1; | |
console.log(1); | |
fetch(url) | |
.then((res) => res.blob()) | |
.then((data) => { | |
let metadata = { | |
type: "image/png", | |
}; | |
temp1 = new File([data], "test.png", metadata); | |
}); | |
let container = new DataTransfer(); | |
container.items.add(temp1); | |
let inputForm = document.querySelector("input.mkhogb32"); | |
inputForm.files = container.files; | |
inputForm.dispatchEvent(new Event("change", { bubbles: true })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment