Skip to main content

Uploading image from a base64 string



  • Roee Ben Ari

    Hi Asi, 

    Can you please open a support ticket via and share the code responsible for the error alongside an example file that fails so we can further investigate the issue?


  • miguel

    Same problem

  • Asi Oren

    Hey Miguel,

    My problem was solved
    Can't remember exactly what solved it for me but here is the upload code from the server:`/${url}`, function (req, res) {
        var dataURI = req.body.dataURI;
        var uploadStr = 'data:image/jpeg;base64,' + dataURI;

        cloudinary.v2.uploader.upload(uploadStr, {
            overwrite: true,
            invalidate: true,
            width: 810, height: 456, crop: "fill"
            function (error, result) {
    Hope it help
  • Luka


    The problem has taken place because you shouldn't place spaces into your

    data:image/jpeg;base64,[your_string] string.

    At least it solved the problem for me :)

    Hope it helps someone.

    (i wrote this for someone who would have the same problem in the future)

  • valentin

    Buenos dias, 

    Estoy teniendo el mismo problemas y no puedo encontrar la solucion realmente. 

    const uploaded = await cloudinary.uploader.upload(image, {
                    upload_preset: 'winesImg'
    ese seria el upload para subir la imagen a cloudinary, la propiedad image me llega por body la cual si la paso asi me tira el error de ENAMETOOLONG, en cambio, probe haciendo un console.log a lo que me llega y pegandolo en lugar de poner la image y si se carga en cloudinary. no puedo entender por que el error, estaria muy agradecido si puedieran ayudarme.

    Good morning, 

    I am having the same problem and can't really find the solution. 

    const uploaded = await cloudinary.uploader.upload(image, {
                    upload_preset: 'winesImg'

    that would be the upload to upload the image to cloudinary, the image property arrives to me by body which if I pass it this way I get the error of ENAMETOOLONG, instead, try making a console.log to what I get and pasting it instead of putting the image and if it loads in cloudinary. I can not understand why the error, I would be very grateful if you could help me.

  • Eric Pasos

    Hi Valentine,

    Can you please help to open a support ticket here ( and to provide us with image information and your cloud name so we can investigate the issue?

    Thanks in advance.


Post is closed for comments.