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??
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??
Share Improve this question asked Oct 4, 2022 at 8:29 appleapple 191 silver badge3 bronze badges1 Answer
Reset to default 5You can do this by using fallowings:
fetch('https://i.imgur./fHyEMsl.jpg')
.then((res) => res.blob())
.then((myBlob) => {debugger
const myFile = new File([myBlob], 'image.jpeg', {type: myBlob.type});
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744731928a4590515.html
评论列表(0条)