Cloudinary Upload Base64 Image

:bullseye: What is your goal?

Upload a Base64 file to cloudinary

:thinking: What is the problem & what have you tried?

The upload isn’t working as it return a [400] Invalid image file.
I’ve checked everything, i’ve made sure my base64 uri is valid using this website Base64 Image Viewer
, made sure no spaces anywhere, i’ve looked at the cloudinary support document, and asked it’s support and they told me that what I’m sending via the api is valid on their end. But for some reason I’m getting this error.

I’ve tried smaller images well below the 60MB limit.
I’ve tried jpegs and pngs.
I’ve tried to mainly trigger the api call with the Upload a Resource Module.

:clipboard: Error messages or input/output bundles

[400] Invalid image file.

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Welcome to the Make community!

You probably need to strip away the “signature” part of the data.

To do this, you can use the built-in function:

  • replace
    replace(text; search string; replacement string)

Here’s an example of how you can use this function:

{{ replace(1.data; "/^.+base64,/"; emptystring) }}
:warning: Make Input Markup:
        Copy-paste the above into the field, including start/end curly brackets for it to import as intended

After pasting this into the File field, change 1.data to the variable containing the full image data.

@samliew
P.S.: investing some effort into the tutorials in the Make Academy will save you lots of time and frustration using Make!

If the Base64 itself is valid, then the issue is usually the format being sent to the module, not the image content.

From your screenshot, it looks like you’re pasting the full data:image/png;base64,... string into the File field. In Make, that field often expects the actual file/binary data, not the full Data URI string, so Cloudinary ends up rejecting it as an invalid image.

So I’d check that part first, because this feels more like a format mismatch in the request than a bad image.

I’ve tired this aswell, and just having the base64 string of the image.

I’ve also tired converting it to binary and still get the same issue.

I’ve also deleted and made the scenario again with just the cloudinary upload module and still get teh same issue.

Ultimately from here I just think it’s a problem with the module it self in uploading base64. As using the url option works. Only problem is that the image i have is only in base64 when i recieve.

I might just try calling Cloudinary through the http call module instead.

I’ve just looked at the Cloudinary API documentation, and it actually provided an example with the file “signature”. However, there is no way of knowing how the module’s connection is coded without trial and error.

Alternatively, I would recommend uploading using a URL instead, which should be more reliable, and saves on data transfer.

@samliew

Thanks for the reply and trying to figure this out for me. I’ve been able to set up the HTTP model correctly to send my base64 code now which works well. And then I use the URL in my workflow.

It just must be something I don’t understand about the cloudinary base64 module that I can’t get to work, oh well.