<!DOCTYPE html>
<html>
<head>
	<title>Base64 to File Converter</title>
</head>
<body>
	<h1>Base64 to File Converter</h1>
	<form>
		<label for='base64'>Base64 String:</label><br>
		<textarea id='base64' name='base64' rows='10' cols='50'></textarea><br>
		<label for='filename'>Filename:</label>
		<input type='text' id='filename' name='filename'><br><br>
		<input type='button' value='Convert' onclick='convert()'>
	</form>
	<script>
		function convert() {
			var base64 = document.getElementById('base64').value;
			var filename = document.getElementById('filename').value;
			if (base64 && filename) {
				var link = document.createElement('a');
				link.download = filename;
				link.href = 'data:application/octet-stream;base64,' + base64;
				document.body.appendChild(link);
				link.click();
				document.body.removeChild(link);
			} else {
				alert('Please enter a valid Base64 string and filename.');
			}
		}
	</script>
</body>
</html>
Base64 to File Converter: Convert Base64 Strings to Files Online

原文地址: https://www.cveoy.top/t/topic/lOHL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录