Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6544567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:28:52+00:00 2026-05-25T11:28:52+00:00

If I loaded a js file in a <textarea> with a save button below

  • 0

If I loaded a js file in a <textarea> with a save button below it, can I save that to an existing js file on my server and then reload it. Basically, what I want to do would work just like a wysiwyg except I want to be able to save the js to an existing file.

I am loading the js file using document.write (“<script src='file.js'></script>“) which works.

BTW, this site would not let me put the ‘<‘ in the document write.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:28:52+00:00Added an answer on May 25, 2026 at 11:28 am

    Short answer: Yes, but from your post I don’t think you’d find it easy.

    In some more depth, you’ll need to use a server-side language such as PHP for this.

    I won’t go into how to get set up with PHP, we’ll assume you know that, and if you don’t then you have a great excuse to go Googling 🙂 However, here’s a simple working example script for you.

    WARNING: There are a lot of pitfalls with allowing people to write to files on your server. You CERTAINLY don’t want to make something like this accessible to anyone except HIGHLY trusted people. I can’t over-emphasise how careful you should be with something like this unless you understand the implications of it.

    <?php
    
    // Change this to the file you want to be editing
    // This path is relative to this script
    // So if this script is in /somewhere/something/scripts/save.php
    // And your file is at /somewhere/something/files/hello.txt
    // This should read: $fname = "../files/hello.txt";
    $fname = "something.txt";
    // Now don't touch anything else :)
    
    
    
    // This checks if we've submitted the file
    if ($_SERVER['REQUEST_METHOD'] == 'POST')
    {
        // Get the posted content
        $content = $_POST['content'];
    
        // Open the file, or exit with an error message if we can't
        if (!$handle = fopen($fname, 'w')) {
            echo "Cannot open file ($filename)";
            exit;
        }
        // Write the new content into the file
        fwrite($fhandle, $content);
        fclose($fhandle);
    }
    
    // Get the contents of the file
    $content = file_get_contents($fname);
    
    ?>
    <form action="" method="post">
        <p>Editing <?php echo $fname; ?></p>
        <textarea name="content"><?php echo $content; ?></textarea>
        <input type="submit" value="Save" />
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've loaded file in div $(#div).load(file.txt); That file has html images . I want
Can anybody help with converting an SDL_Surface object, a texture loaded from a file,
So I have an SQL dump file that needs to be loaded using mysql_query().
I have an xml file (loaded in with URLLoader) that looks like this: <?xml
I have an byte array of an doc file loaded in memory. I would
I can't seem to access anything from a loaded swf file. I can, however
We use JAAS in a heavily loaded web server. The configuration file is loaded
I have to draw a bitmap multiple times. It's loaded from file. I can
In my application, I am using OpenFileDialog and then assign the loaded file to
Clicking a button on a page causes to a javascript file to be loaded.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.