How do I load Great Score Pic.?

0 favourites
  • 6 posts
From the Asset Store
4 Pics 1 Word is a template for creating the popular game
  • Hi All,

    Anyone got any pointers on how to upload a pic. to the server that can then be updated/overwrote by the next high score?

  • This is where I have managed to get to,

    i am thinking the AJAX is wrong & am wondering how the server makes a file to put the binary data into?

  • Has anyone seen a tutorial or documentation on the File chooser/upload?

  • Hopefully I can help, and should probably do a tutorial on this.

    If some of this is too basic, sorry just covering the bases.

    1. The picture must be sent on the data line of the ajax request (in C3) to be a POST *thus avoiding error 414 issues* (the URL line in C3 is actually a GET line and you can mix GET/POST as needed). (servers usually limit GET since it goes in the browser URL, this helps avoid DDOS issues)

    2. Urlencode(your data) handles your *.php str_replace items making that unnecessary.

    3. No need to send the "data:image...." to the server unless you just want to, *wasted data*.

    4. You might do a test TextInput box to show your base64 data just to double check it's formatting.

    5. Post to server, check and see that it made your data make it (in phpmyadmin, you might want that cell to be longtext

    6. On retrieval, laod from "data:image...." and ajax.lastdata .

    On a side note you can "compress" the image by using drawingcanvas (it can be dramatic, especially if there are a lot of images).

    ***I just went through this the other day and have it working without issue. You might look at this post and read about the errors I made in the discovery process.

    construct.net/en/forum/construct-3/how-do-i-8/loading-image-binary-157901

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Addendum: I was just doing a mixed GET/Post and realized you're doing a GET only.

    On your ajax the send "" is where your POST should go. I'd bet if you change nothing, run your code in the browser, open the Developer tools and find the error url. Copy and past that into the address bar, 99.9% chance you're getting an error 414.

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