Skip to main content

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



  • 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.


  • 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:

  • sankar

    can some one post a full working example rather than snippets of code mentioned above for a direct upload from the browser to cloudinary please ?


  • Raz Ziv

    Hi Sankar,

    Please find the following jsfiddle, which shows a full implementation of direct uploading via the browser:

    In case you still encounter any issues when trying to implement the same in your project, please open a support ticket at and we will be happy to further assist you.

  • sankar

    thanks Raz

    any chance you can show an example if i already have the base64 image as a DataURI ?


    Thanks again

  • Raz Ziv

    Sure, Sankar.

    Please see below an additional jsfiddle for uploading a base64 URI of an image directly from your browser, using jQuery:

  • Daniel Ross

    is it possible to fetch a base64 uri as a layer?

  • Anthony Datu

    Hi @Daniel Ross, 

    Yes, you may fetch a base64 URI as a layer.  Here's the reference documentation for layer `l_fetch`:

    I hope that helps.  


  • Daniel Ross

    I was wondering about something like


    Of course i said they can upload it and convert then use.

    Thanks Anthony.

  • Tamara Yulevich

    Hi Anthony,

    Currently, this is not something that we support. Please also feel free to suggest this on our public roadmap. Please let me know if there is anything else I can help you with



Please sign in to leave a comment.