Sometimes the cloudinary API uploader throws an error trying to upload base64 svg...

Options
Dmytro123
Dmytro123 Member Posts: 2
edited August 2023 in Developer APIs

Hello! I know that to upload the base64 image I need to use this format

data:image/svg+xml;base64,PHN... but sometimes it doesn't work, could you help me?


This image works fine: `first.txt`


I used these options

folder: 'contracts/0x0747118c9f44c7a23365b2476dcd05e03114c747'

overwrite:true

public_id:'0x0747118c9f44c7a23365b2476dcd05e03114c747_1942'


But it throws an error: 'Resource is invalid' for `failed.txt`

And I'm not sure why, please help!


Tagged:

Best Answer

  • Tom
    Tom Member, Cloudinary Staff Posts: 65
    Answer ✓
    Options

    Hi @Dmytro123 ,

    Thanks for reaching out.

    It looks like the base64 data is for SVG files and the second one fails because it has more than 1000 tags.

    If you'd like, I can enable a setting in your account to allow SVG uploads that contain more than 1k tags so just let me know.

    Thomas

Answers

  • Dmytro123
    Dmytro123 Member Posts: 2
    Options

    Hey Thomas, yes sure! We definitely need that! Thanks

  • Cloudinary Team
    Cloudinary Team Administrator, Cloudinary Staff Posts: 123 admin
    Options

    Hi Dmytri,

    You will soon receive another mail from Cloudinary asking some questions about the account and then we can go ahead and change the flag.

    Lookout for an email from Support at Cloudinary.

    Regards,
    Akshay

    Helpful Links For You
    💬 Share questions, connect with other users in our Cloudinary Community forums and Discord server!
    🧑‍🎓 Join our Cloudinary Academy for free courses, workshops and other educational resources.
    📄 Read our documentation for in-depth details on Cloudinary product features and capabilities
    📰 Check out the Cloudinary blog for the latest company news and insights

  • Cloudinary Team
    Cloudinary Team Administrator, Cloudinary Staff Posts: 123 admin
    Options

    Hi there,

    The setting that Thomas mentioned has been enabled for your account, so you should be able to proceed now. Please give your upload another try and let us know how it goes. Of course, if you have any questions at all, do not hesitate to ask.

    Kind regards,

    Tia

    Helpful Links For You
    💬 Share questions, connect with other users in our Cloudinary Community forums and Discord server!
    🧑‍🎓 Join our Cloudinary Academy for free courses, workshops and other educational resources.
    📄 Read our documentation for in-depth details on Cloudinary product features and capabilities
    📰 Check out the Cloudinary blog for the latest company news and insights