How to upload a Base64 DataURI string of an image directly from the browser?




  • Avatar
    Nicolson Dsouza

    I still don't get it,

    var imageData = canvas.toDataURL();
    $('.image_upload').fileupload('option', 'formData').file = imageData;
    $('.image_upload').fileupload('add', { files: [ imageData ] });

    I still don't know why do I have to give a dom element to uploada data uri which I already have it.
    and there is no call back to let me know when the data uri is actually uploaded.

    Is this client side code only, or it involves server side code too?
    I am nodejs developer.

    Sorry if I am missing something,
    an urgent reply would be nice.


  • Avatar
    Roee Ben Ari

    The DOM element with the class of image_upload (in the example above) is the input field that is initialized with the uploader responsible for getting the image from the client. The upload is triggered when its file attribute contains data.

    The upload call has several callback events which you can listen to. One of those is cloudinarydone, which is fired once the upload is completed.
    For more information:

    Regarding your question - This is a client-side code (jQuery). You can perform such uploads from the server-side too, for more information:

Please sign in to leave a comment.