Skip to content

Instantly share code, notes, and snippets.

@m1r4z
Created September 25, 2021 12:18
Show Gist options
  • Save m1r4z/2a035491b1eed894c57b19e1b781a53d to your computer and use it in GitHub Desktop.
Save m1r4z/2a035491b1eed894c57b19e1b781a53d 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