1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Anyone knows html? css?

Discussion in 'General Discussion' started by john burns, Dec 16, 2017.

  1. john burns
    Offline

    john burns Member

    Joined:
    Mar 12, 2014
    Messages:
    681
    Likes Received:
    16
    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');">
     
  2. Vorspire
    Offline

    Vorspire Vita-Nex: Core
    Admin ServUO Developer

    Joined:
    Jul 29, 2013
    Messages:
    1,061
    Likes Received:
    189
    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?
     
  3. john burns
    Offline

    john burns Member

    Joined:
    Mar 12, 2014
    Messages:
    681
    Likes Received:
    16
    this is what I am playing with, its the bookcodegenerator script-set.

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

    Attached Files:

  4. Vorspire
    Offline

    Vorspire Vita-Nex: Core
    Admin ServUO Developer

    Joined:
    Jul 29, 2013
    Messages:
    1,061
    Likes Received:
    189
    First I see this in the source;
    Code (C#):
    1. <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 (C#):
    1. <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.
     
    • Two Thumbs Up Two Thumbs Up x 1
Similar Threads: Anyone knows
Forum Title Date
ServUO Discussion Anyone good at updating scripts Oct 10, 2018
General Discussion Does anyone have? Sep 27, 2018
3rd Party Support Svn Update Problem anyone? Apr 19, 2018
3rd Party Discussions Just curious anyone can script outside UO? Mar 13, 2018
Script Support anyone have some gm tools? Nov 5, 2017
Script Support Anyone can help with this error :) Sep 25, 2017
General Discussion Champion Artifact Drops, anyone? Aug 13, 2017