• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

(Solved) Saving data to webserver HTML5

2DKnights

Member
Hi I'm trying to save data to a webserver using HTML. Documentation says that I must use buffer_save_async() to load or save files on HTML5. This works fine under windows, but when I deploy using HTML5 on a webserver I get nothing saved. I'm looking for any solution as I only need to save a bit of data < 100KB.


GML:
//TEST SAVING WITH BUFFERS
if keyboard_check_pressed(ord("B")){
    var out_buffer   = buffer_create(256, buffer_grow, 1);
    show_debug_message("bufferid = " + string(out_buffer));
   
    var write_status = buffer_write(out_buffer, buffer_string, "one fish two fish red fish blue fish");
    show_debug_message("buffer status " + string(write_status));
   
    buffer_save_async(out_buffer,"output.buf",0,buffer_get_size(out_buffer));

    buffer_delete(out_buffer);
}
 

FrostyCat

Redemption Seeker
Whenever you're dealing with "files" on the HTML5 exports, you don't have actual read-write access to the file system, on the server or directly on the user's system. The runner requests a starter sample from Included Files, then emulates the reads and writes in local storage. Start by adding a blank output.buf file to Included Files.
 

2DKnights

Member
Whenever you're dealing with "files" on the HTML5 exports, you don't have actual read-write access to the file system, on the server or directly on the user's system. The runner requests a starter sample from Included Files, then emulates the reads and writes in local storage. Start by adding a blank output.buf file to Included Files.
Is there anyway to send data to a server then?
 

FrostyCat

Redemption Seeker
As a starter, look up how web-based high scores are done. Then instead of submitting and retrieving scores, you submit and retrieve data. Do note that with a buffer, if any null bytes are possible in your output, you will need to base64-encode on top of the URL-encode prescribed in the tutorial.
 
Top