My Imgur upload function does not work without any reason.

0 favourites
  • 6 posts
From the Asset Store
You can upload screenshots and photos to your server very easily.
  • Hey Internet, I'm trying to upload a CanvasSnapshot to Imgur because they accept base64 data.

    This is the error.

    {"data":{"error":"Image format not supported, or image is corrupt.","request":"\/3\/image","method":"POST"},"success":false,"status":400}[/code:2u917ua9]
    Following their [url=]examples[/url] and reading the [url=]API[/url], I tried every single setup for the AJAX call.
    Can you help me out?
    [h2]My client ID is showing in the .capx, don't mind it; I will delete it anyway when this gets resolved.
    [url=]Get yourself a client ID[/url].[/h2]
  • The same exact code works in jQuery, I don't know what seems to be the issue.

  • I'm dying.

  • Set the POST data to:

    "type='base64'&image=" & URLEncode(RegexReplace(CanvasSnapshot, "data:image/png;base64,", "", ""))[/code:1wem2q5u]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ramones Thank you very much, I still don't understand why that syntax works and mine didn't... but that's how life goes, I guess,

  • The query string format for GET/POST requests is key-value pairs like key=value, separated by &, with + replacing any spaces.


    It looks like you were trying to use jQuery syntax. In jQuery you can pass an object { parameter1: value1, parameter2: value2 } which jQuery will convert into a query string like above.

    And then the base64 encoded image could contain & or + or other characters that could be confused as part of the query string so you need to wrap it in URLEncode().

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