How do I Use AJAX to upload SnapShot to server.

0 favourites
  • 6 posts
From the Asset Store
You can upload screenshots and photos to your server very easily.
  • I want to upload to a server a picture taken from the mobile camera.

    I'm trying an ajax request to php but for some reason, the snapshot won't arrive on the server, any other parameter that i use gets there ok, but the snapshot comes out blank.

    "" & UserMedia.SnapshotURL

    above is the string i'm using for the request.

    Is this the way to do it?


  • I'm not sure what environment you are running the project, so my help can be limited. I also do not know what your php code is.

    If this is a phone app, which I am assuming it to be. I believe SnapshotURL gives the location of the snapshot on the phone's file system, e.g. /internalstorage/yourapp/snapshots or whatever. Then if your php script gets this data what is it to do? I doesn't actually have the file you're telling it, only its path on the phone it was taken on. I do not know if Construct has a proper upload feature, but what you could possibly do it retrieve the data from the snapshot, the actual 1's and 0's in a reconstructible format, an image raster. Then you can get this data and post it to your php page for the php to then reconstruct the data from the raster and display the image.

    I'm no expert in this area so this could all be completely wrong, but I hope it helps.

  • UserMedia.SnapshotURL is actually an image encoded as a data URI, so he should be able to upload it to any php script using a post. Might we see your events ? It might be easier to help.

  • I found a similar post to mine, apparently the encoded image is too large a string to be passed as a POST to PHP. Someone had the same issue as me and got around it using a dropbox plugin. Its too much of a hack for what I need to do. I'm going native for this one, thanks guys...

  • Have you tried tweaking the settings of your server to allow for bigger http request ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried tweaking the settings of your server to allow for bigger http request ?

    Unfortunately it's shared hosting... I don't have access..

    It's a very simple app, I decided to make it in Flash Builder.


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