unsignedUploadResource method

Future<CloudinaryResponse> unsignedUploadResource(
  1. CloudinaryUploadResource resource
)

Uploads a file of resourceType with fileName to a folder in your specified cloudName using a uploadPreset with no need to specify an apiKey nor apiSecret.

Make sure you set a uploadPreset in your resource.

resource A CloudinaryUploadResource object with all necessary data

Response: Check all the attributes in the CloudinaryResponse to get the information you need... including secureUrl, publicId, etc. See also:

Implementation

/// See also:
///
///  * [CloudinaryUploadResource], to know which data to set
Future<CloudinaryResponse> unsignedUploadResource(
    CloudinaryUploadResource resource) {
  assert(resource.uploadPreset?.isNotEmpty ?? false,
      'Resource\'s uploadPreset must not be empty');
  return _client.unsignedUpload(
    uploadPreset: resource.uploadPreset!,
    filePath: resource.filePath,
    fileBytes: resource.fileBytes,
    publicId: resource.publicId,
    fileName: resource.fileName,
    folder: resource.folder,
    resourceType: resource.resourceType,
    optParams: resource.optParams,
    progressCallback: resource.progressCallback,
  );
}