base64转file上传
base64图片转file上传
base64ToFile(dataurl, filename) { const arr = dataurl.split(',') const mime = arr[0].match(/:(.*?);/)[1] const bstr = atob(arr[1]) let n = bstr.length const u8arr = new Uint8Array(n) while (n--) { u8arr[n] = bstr.charCodeAt(n) } return new File([u8arr], filename, { type: mime }) }
时间如白驹过隙,忽然而已,且行且珍惜......