Currently, I'm using this code:
<?php
header('Content-type: application/force-download');
header('Content-Disposition: attachment; filename="'.$_POST['savename'].'.bob"');
echo($_POST['savedata'])
?>
It gets the data of a form, creates an attachment and sends it right back. This is useless, because the client has the data. I would like to rewrite it to:
myForm.onsubmit = SomeSaveToFileFunction()