If anyone know html, or css if it is, and can change this button code so the output is saved to the web server, instead of downloaded to the pc, it would be greatly appreciated.

<input type="button" class="btn btn-success btn-block" value="Save-To-Server" onclick="saveAs(new Blob([document.form.thecode.value], {type: 'text/cs;charset=utf-8'}), document.form.file.value + '.cs');">
 
The destination for the data is defined in the <form> element using the "action" attribute.

Set the "action" attribute to any URL. Set the "method" attribute to "POST".

You have inline JavaScript that hooks the button's "onclick" event, you will need to remove that entirely.

Your other option is to ignore the above and just edit the local JavaScript method named "saveAs", which must be defined somewhere in your code.

Do you have a full copy of the source code, or a link to the page that I can see?
 
this is what I am playing with, its the bookcodegenerator script-set.

Posting the whole thing in case you need something from it.
 

Attachments

  • bookcodegenerator.zip
    142.7 KB · Views: 4
First I see this in the source;
Code:
<form name="form" action="download.php" method="post">

There is no download.php in the package, though, it doesn't matter because the form submission is overridden by JavaScript event hooks.
However, this is the attribute you need to change. You need to write a small piece of PHP that will take the submitted data and write it to a file on your web host.

Create an upload.php and change action attribute to action="upload.php".
In upload.php, you'll only need a few lines of code, you can find tons of examples of how to write files using PHP on Google.

When you have that, you can add a new button to the page that doesn't have any JavaScript event hooks, a simple;
Code:
<input type="submit" value="Upload Save" />

Once you're done and you click the new button, it will submit the entire form data to upload.php.
 
Back