Upload Image to Cloudinary

  1. 5 years ago

    VinDo

    18 Oct 2018 User since 2018

    Does anyone have a working example of uploading an image from the app to Cloudinary?

    I have followed an example posted on these forums that uploads to Imgur. But I haven't been able to replicate success with Cloudinary!

    Attached is my attempt!

  2. andrea

    18 Oct 2018 Administrator User since 2016

    Hi @VinDo,
    I succeed in uploading a sample image after two changes in your project:
    1. The file parameter should be a Data URI as specified in the API documentation , so the dynamic property of the HTTPRequest is set with the following code:

    Cloudinary.Upload_Image.file = "data:image/jpeg;base64," + ImageData.base64();

    2. The file and upload_preset parameters are passed as Body Parameters of the POST request, not as Query Parameters.

    Please see the attached modified version of your project.

    This was the content of the response of my upload request:

    [public_id:yie4cuj5flmquhblncra,bytes:84428,format:png,resource_type:image,placeholder:false,created_at:2018-10-18T21:06:39Z,etag:8d336031cc32ce127ddfda69e2c40035,tags:[],secure_url:https://res.cloudinary.com/di9l3wnne/image/upload/v1539896799/yie4cuj5flmquhblncra.png,type:upload,signature:bb07377b4d032b0c65af2f76e5de001f309798fd,height:244,width:200,url:http://res.cloudinary.com/di9l3wnne/image/upload/v1539896799/yie4cuj5flmquhblncra.png,access_mode:public,version:1539896799]
  3. VinDo

    20 Oct 2018 User since 2018

    Andrea, this is fantastic many thanks for your help

or Sign Up to reply!