有什么方法可以解决此问题,如何为base64制作下载链接
<!DOCTYPE html>
<html>
<head></head>
<body>
<input id="fileupload" type="file" onchange="onFileChanged()" />
<a href="javascript:void(0)" download="DRSD_MCCWebPortal_V7.pdf"> Download Text </a>
<script>
var b6;
var download = document.querySelector( "a[ download ]" );
function onFileChanged(){
var x = document.getElementById("fileupload");
var myReader = new FileReader();
myReader.onloadend = (e) => {
b6 = myReader.result.toString()
download.setAttribute("href",(b6));
};
myReader.readAsDataURL(x.files[0]);
}
</script>
</body>
</html>