Реализовано на javascript:
<!DOCTYPE html>
<html lang="ru">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<button onclick="saveAs()" type="button">Сохранить файл</button>
	<script>
		function saveAs() {			
			var e = document.createElement('a');			
			e.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent('Привет программистам JavaScript'));
			e.setAttribute('download', 'text.txt');
			document.body.appendChild(e);
			e.click();
			document.body.removeChild(e);
		}
	</script>
</body>
</html>
Информацию нашел здесь: 
https://stackoverflow.com/questions/...through-server