Issue
let url ='https://xxxx/image.jpg';
let blob = new Blob([url]);
let file = new File([blob], "filename", { type: "image/jpg" });
i am working on an angular project and would love to assign an image to file for upload. However the system cannot load the image after upload. any ideas??
Solution
You can do this by using fallowings:
fetch('https://i.imgur.com/fHyEMsl.jpg')
.then((res) => res.blob())
.then((myBlob) => {debugger
const myFile = new File([myBlob], 'image.jpeg', {type: myBlob.type});
});
Answered By - ZsoltB
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.