let url ='https://xxxx/image.jpg';
let blob = new Blob([url]);
let file = new File([blob], "filename", { type: "image/jpg" });
我正在做一個角度專案,并希望將影像分配給檔案以供上傳。但是上傳后系統無法加載圖片。有任何想法嗎??
uj5u.com熱心網友回復:
您可以通過使用休閑來做到這一點:
fetch('https://i.imgur.com/fHyEMsl.jpg')
.then((res) => res.blob())
.then((myBlob) => {debugger
const myFile = new File([myBlob], 'image.jpeg', {type: myBlob.type});
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/520426.html
