How to save a image on server with javascript?
<p>I'm working in a little web app that generates an base64 image, I'm using blob to put it back into a file (is a .png but I haven't renamed it yet), now I'm trying to save it on my sever Any ideas or different approaches?  </p>

<p>This is the script:</p>

<pre><code>var img = document.getElementById("MyPix");
    img.onclick = function() {

        var image_data = atob(img.src.split(',')[1]);
        var arraybuffer = new ArrayBuffer(image_data.length);
        var view = new Uint8Array(arraybuffer);
        for (var i=0; i&lt;image_data.length; i++) {
            view[i] = image_data.charCodeAt(i) &amp; 0xff;
        }
        try {
            var blob = new Blob([arraybuffer], {type: 'application/octet-stream'});
        } catch (e) {
            var bb = new (window.WebKitBlobBuilder || window.MozBlobBuilder);
            bb.append(arraybuffer);
            var blob = bb.getBlob('application/octet-stream');
        }

        var url = (window.webkitURL || window.URL).createObjectURL(blob);

        valor = (document.getElementById("link").value = url)

        location.href = valor; 

    };
</code></pre>

<p>I'm not very good with js so if you want to have a better idea visit the project <a href="http://forbesstudio.com/apps/post_card/index2.html" rel="nofollow">clicking here</a> its all javascript so just see source code.</p>
