0
votes

the docs here indicate an overwrite option:

overwrite (Boolean) - Whether to overwrite existing resources with the same public ID. When set to false, return immediately if a resource with the same public ID was found. Default: true.

When I set it to false, the files still upload all their data. This seems to be an error.

cld.uploader.upload(filePath, function(result) {
  if (result.error) {
    return done(result.error);
  }
  done();
}, {
  // Note these are the upload options.
  resourcetype: 'auto',
  publicid: publicId,
  overwrite: false,
});
1

1 Answers

0
votes

When overwrite: false is used, Cloudinary checks whether there's an image existing in your account assigned with the same public ID as assigned in the upload options, if there isn't - The new image is uploaded. Otherwise, you got a response back, which looks like there was an upload performed, however the details you actually get from the response are of the already (old) uploaded image, not the new one. Also, an additional parameter is returned (existing), when it is returned as true this means that no upload has been made.