I have a javascript bookmarklet which creates a screenshot of an element and saves it as a base64 encoded string.
Now, I need to send that image/string to my own server to save it. Only problem is that it’s 6000+ characters long, or about 61 KB, making it unrealistic to GET it back to my server.
Is there some sort of external service that would somehow retrieve it back on my server? How can I send this image to my server?
Use POST.
Option A.) Use JavaScript to create a form, and post the data. If you do not want the page location to change, set
targetof the form to a hidden iframe.If you need to get a response back from your server after the post, add a unique key to the form that you post, like
<input type="hidden" name="key" value="...">and then after the post is done use JSONP to get the response, likehttp://yourserver.com/donepost.php?key=.... Since you can’t be sure that the post will complete before the JSONP call is made, you’ll need to keep rechecking the server until a valid response is available or it times out.Option B.) Post using AJAX. Set the
Access-Control-Allow-Originheader on your server to allow this.