yavg
yavg

Reputation: 3051

how can I change the name of my image when uploading it to the cloudinary server?

I am trying to change the name of an image that comes in base64, to a name that I will define later. how can I do it? I want to customize the names in the cloudinary server

  var uploadOptions = {
    params : {
      //'upload_preset': "YOUR_IMAGE_UPLOAD_PRESET",
      'upload_preset': "xxx",
    }

//imageURI is base64 image
//.upload("YOUR_IMAGE_UPLOAD_LINK", imageURI, uploadOptions)
  .upload("https://api.cloudinary.com/v1_1/xxxx/image/upload", imageURI, uploadOptions)

    .then(function(result) {

Upvotes: 0

Views: 222

Answers (1)

Roee Ben-Ari
Roee Ben-Ari

Reputation: 610

Naming the image is done using the public_id parameter, for example:

var uploadOptions = {
    params : {
      //'upload_preset': "YOUR_IMAGE_UPLOAD_PRESET",
      'upload_preset': "xxx",
      'public_id': "imageName"
    }

It can also contain folders. For example:

'public_id': "myfolder/imagename"

Or

'public_id': "imagename"
'folder': "myfolder"

You can read more about it here.

Upvotes: 1

Related Questions