Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sahwar/49c49d17232616788fec7a238ac3b49d to your computer and use it in GitHub Desktop.
Save sahwar/49c49d17232616788fec7a238ac3b49d to your computer and use it in GitHub Desktop.
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