How do I save a json file on the server?

0 favourites
  • 9 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • I know how to do this on my machine but I don't know how to save it on the server. Is it possible?

  • you can make a script in PHP that you will send the JSON data with the POST in AJAX, and a script in PHP that take the value and build the file .json where you want in the server...

    try to find on internet "make .txt/json file in php"

    this works for me very well, I don't know if there is a method to upload directly the file, I mean, save on the cache and after send the file to a specific folder, but I think is more safe with the first method

  • Hey Thanks but I what I found is very specific. Do you have an example to show me? Something that worked for you would be fine.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • UP

  • BUMP!

  • $sql = "insert into `yourtablename` ('$yourtablerow) values ($yourvalues) where `yourvariable`=`yourvarisble1

  • I want a text file in a json format not a db. Thanks anyway.

  • on server you need php script:

    <?php
    
    $name=$_POST['username'];
    $txt = $_POST['data'];
    
    $myfile = fopen($name.".txt", "w") or die("Unable to open file!");
    
    fwrite($myfile, $txt);
    fclose($myfile);
    exit();
    ?>[/code:1gsclnj5]
    ************************************************
    
    [url=https://app.box.com/s/s67acajd4pmmb0e5od1v4o20ttfnvpmh]writeFilephp.capx[/url]
    
    ***********************************************
    
    [img="http://lookpic.com/O/i2/950/ki6ifuyF.png"]
    [img="http://lookpic.com/O/i2/1751/pqBGrAKj.png"]
    [img="https://media.giphy.com/media/3oz8xDXdCiNTX5SAJa/source.gif"]
  • Hey korbaach. Thank you. You are a true life saver.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)