class UploadApi

Class UploadApi for accessing Cloudinary Upload API functionality

Properties

ApiClient $apiClient Defined in UploadApi class from UploadTrait

Methods

createArchiveAsync(array $options = [], string|null $targetFormat = null)

Creates a new archive in the server and returns information in JSON format.

createArchive(array $options = [], $targetFormat = null)

Creates a new archive in the server and returns information in JSON format.

createZipAsync(array $options = [])

Creates a new zip archive in the server and returns information in JSON format.

createZip(array $options = [])

Creates a new zip archive in the server and returns information in JSON format.

downloadArchiveUrl(array $options = [])

Returns a URL that when invoked creates an archive and returns it.

downloadZipUrl(array $options = [])

Returns a URL that when invokes creates a zip archive and returns it.

privateDownloadUrl(string $publicId, string $format, array $options = [])

Returns a URL that when invoked downloads the asset.

downloadFolder(string $folderPath, array $options = [])

Creates and returns a URL that when invoked creates an archive of a folder.

downloadBackedupAsset(string $assetId, string $versionId)

The returned url allows downloading the backedup asset based on the the asset ID and the version ID.

destroyAsync(string $publicId, array $options = [])

Immediately and permanently deletes a single asset from your Cloudinary cloud.

destroy(string $publicId, array $options = [])

Immediately and permanently deletes a single asset from your Cloudinary cloud.

renameAsync(string $fromPublicId, string $toPublicId, array $options = [])

Renames the specified asset in your Cloudinary cloud.

rename(string $fromPublicId, string $toPublicId, array $options = [])

Renames the specified asset in your Cloudinary cloud.

explicitAsync(string $publicId, array $options = [])

Applies actions to an already uploaded asset.

explicit(string $publicId, array $options = [])

Applies actions to already uploaded assets.

updateMetadataAsync(array $metadata, array $publicIds, array $options)

Populates metadata fields with the given values. Existing values will be overwritten.

updateMetadata(array $metadata, array $publicIds, array $options = [])

Populates metadata fields with the given values.

buildUploadParams(array $options)

Consolidates the upload parameters.

uploadAsync(mixed $file, array $options = [])

Uploads an asset to a Cloudinary cloud.

upload(mixed $file, array $options = [])

Uploads an asset to a Cloudinary cloud.

unsignedUploadAsync(string $file, string $uploadPreset, array $options = [])

Uploads an asset to a Cloudinary cloud.

unsignedUpload(string $file, string $uploadPreset, array $options = [])

Uploads an asset to a Cloudinary cloud.

__construct(mixed $configuration = null)

Admin Api constructor.

getUploadUrl(string|null $assetType = AssetType::AUTO, string $endPoint = UploadEndPoint::UPLOAD, array $params = [])

Gets upload URL for the specified asset type and endpoint.

Details

PromiseInterface createArchiveAsync(array $options = [], string|null $targetFormat = null)

Creates a new archive in the server and returns information in JSON format.

Parameters

Name Type Description
$options array
$targetFormat string|null

Return Value

PromiseInterface

ApiResponse createArchive(array $options = [], $targetFormat = null)

Creates a new archive in the server and returns information in JSON format.

Parameters

Name Type Description
$options array
$targetFormat

Return Value

ApiResponse

PromiseInterface createZipAsync(array $options = [])

Creates a new zip archive in the server and returns information in JSON format.

Parameters

Name Type Description
$options array

Return Value

PromiseInterface

ApiResponse createZip(array $options = [])

Creates a new zip archive in the server and returns information in JSON format.

Parameters

Name Type Description
$options array

Return Value

ApiResponse

string downloadArchiveUrl(array $options = [])

Returns a URL that when invoked creates an archive and returns it.

Parameters

Name Type Description
$options array Additional options. Can be one of the following:

Return Value

string The resulting archive URL.

string downloadZipUrl(array $options = [])

Returns a URL that when invokes creates a zip archive and returns it.

Parameters

Name Type Description
$options array Additional options. See ArchiveTrait::downloadArchiveUrl.

Return Value

string The resulting archive URL.

See also

ArchiveTrait::downloadArchiveUrl

string privateDownloadUrl(string $publicId, string $format, array $options = [])

Returns a URL that when invoked downloads the asset.

Parameters

Name Type Description
$publicId string The public ID of the asset to download.
$format string The format of the asset to download.
$options array Additional options.

Return Value

string

string downloadFolder(string $folderPath, array $options = [])

Creates and returns a URL that when invoked creates an archive of a folder.

Parameters

Name Type Description
$folderPath string Full path (from the root) of the folder to download.
$options array Additional options.

Return Value

string Url for downloading an archive of a folder.

string downloadBackedupAsset(string $assetId, string $versionId)

The returned url allows downloading the backedup asset based on the the asset ID and the version ID.

Parameters

Name Type Description
$assetId string The asset ID of the asset.
$versionId string The version ID of the asset.

Return Value

string The signed URL for downloading backup version of the asset.

PromiseInterface destroyAsync(string $publicId, array $options = [])

Immediately and permanently deletes a single asset from your Cloudinary cloud.

Backed up assets are not deleted, and any assets and transformed assets already downloaded by visitors to your website might still be accessible through cached copies on the CDN. You can invalidate any cached copies on the CDN with the invalidate parameter.

This is an asynchronous function.

Parameters

Name Type Description
$publicId string The public ID of the asset to delete.
$options array The optional parameters. See the upload API documentation.

Return Value

PromiseInterface

See also

https://cloudinary.com/documentation/image_upload_api_reference#destroy_method

ApiResponse destroy(string $publicId, array $options = [])

Immediately and permanently deletes a single asset from your Cloudinary cloud.

Backed up assets are not deleted, and any assets and transformed assets already downloaded by visitors to your website might still be accessible through cached copies on the CDN. You can invalidate any cached copies on the CDN with the invalidate parameter.

Parameters

Name Type Description
$publicId string The public ID of the asset to delete.
$options array The optional parameters. See the upload API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/image_upload_api_reference#destroy_method

PromiseInterface renameAsync(string $fromPublicId, string $toPublicId, array $options = [])

Renames the specified asset in your Cloudinary cloud.

The existing URLs of renamed assets and their associated derived assets are no longer valid, although any assets and transformed assets already downloaded by visitors to your website might still be accessible through cached copies on the CDN. You can invalidate any cached copies on the CDN with the invalidate parameter.

This is an asynchronous function.

Parameters

Name Type Description
$fromPublicId string The public ID of the asset to rename.
$toPublicId string The new public ID of the asset.
$options array The optional parameters. See the upload API documentation.

Return Value

PromiseInterface

See also

https://cloudinary.com/documentation/image_upload_api_reference#rename_method

mixed rename(string $fromPublicId, string $toPublicId, array $options = [])

Renames the specified asset in your Cloudinary cloud.

The existing URLs of renamed assets and their associated derived assets are no longer valid, although any assets and transformed assets already downloaded by visitors to your website might still be accessible through cached copies on the CDN. You can invalidate any cached copies on the CDN with the invalidate parameter.

Parameters

Name Type Description
$fromPublicId string The public ID of the asset to rename.
$toPublicId string The new public ID of the asset.
$options array The optional parameters. See the upload API documentation.

Return Value

mixed

See also

https://cloudinary.com/documentation/image_upload_api_reference#rename_method

PromiseInterface explicitAsync(string $publicId, array $options = [])

Applies actions to an already uploaded asset.

This is an asynchronous function.

Parameters

Name Type Description
$publicId string The public ID of the asset to apply the actions to.
$options array The optional parameters. See the upload API documentation.

Return Value

PromiseInterface

See also

https://cloudinary.com/documentation/image_upload_api_reference#explicit_method

mixed explicit(string $publicId, array $options = [])

Applies actions to already uploaded assets.

Parameters

Name Type Description
$publicId string The public ID of the asset to apply the actions to.
$options array The optional parameters. See the upload API documentation.

Return Value

mixed

See also

https://cloudinary.com/documentation/image_upload_api_reference#explicit_method

PromiseInterface updateMetadataAsync(array $metadata, array $publicIds, array $options)

Populates metadata fields with the given values. Existing values will be overwritten.

Any metadata-value pairs given are merged with any existing metadata-value pairs (an empty value for an existing metadata field clears the value).

This is an asynchronous function.

Parameters

Name Type Description
$metadata array A list of custom metadata fields (by external_id) and the values to assign to each of them.
$publicIds array An array of Public IDs of assets uploaded to Cloudinary.
$options array The optional parameters. See the upload API documentation.

Return Value

PromiseInterface A list of public IDs that were updated.

See also

https://cloudinary.com/documentation/image_upload_api_reference#metadata_method

mixed updateMetadata(array $metadata, array $publicIds, array $options = [])

Populates metadata fields with the given values.

Existing values will be overwritten.

Any metadata-value pairs given are merged with any existing metadata-value pairs (an empty value for an existing metadata field clears the value).

Parameters

Name Type Description
$metadata array A list of custom metadata fields (by external_id) and the values to assign to each of them.
$publicIds array An array of Public IDs of assets uploaded to Cloudinary.
$options array The optional parameters. See the upload API documentation.

Return Value

mixed A list of public IDs that were updated.

See also

https://cloudinary.com/documentation/image_upload_api_reference#metadata_method

static array buildUploadParams(array $options)

Consolidates the upload parameters.

Parameters

Name Type Description
$options array The optional parameters. See the upload API documentation.

Return Value

array

See also

https://cloudinary.com/documentation/image_upload_api_reference#upload_method

PromiseInterface uploadAsync(mixed $file, array $options = [])

Uploads an asset to a Cloudinary cloud.

The asset can be: * a local file path * the actual data (byte array buffer) * the Data URI (Base64 encoded), max ~60 MB (62,910,000 chars) * the remote FTP, HTTP or HTTPS URL address of an existing file * a private storage bucket (S3 or Google Storage) URL of a whitelisted bucket

This is an asynchronous function.

Parameters

Name Type Description
$file mixed The asset to upload.
$options array The optional parameters. See the upload API documentation.

Return Value

PromiseInterface

Exceptions

ApiError

See also

https://cloudinary.com/documentation/image_upload_api_reference#upload_method

ApiResponse upload(mixed $file, array $options = [])

Uploads an asset to a Cloudinary cloud.

The asset can be: * a local file path * the actual data (byte array buffer) * the Data URI (Base64 encoded), max ~60 MB (62,910,000 chars) * the remote FTP, HTTP or HTTPS URL address of an existing file * a private storage bucket (S3 or Google Storage) URL of a whitelisted bucket

Parameters

Name Type Description
$file mixed The asset to upload.
$options array The optional parameters. See the upload API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/image_upload_api_reference#upload_method

PromiseInterface unsignedUploadAsync(string $file, string $uploadPreset, array $options = [])

Uploads an asset to a Cloudinary cloud.

The upload is not signed so an upload preset is required.

This is an asynchronous function.

Parameters

Name Type Description
$file string The asset to upload.
$uploadPreset string The name of an upload preset.
$options array The optional parameters. See the upload API documentation.

Return Value

PromiseInterface

Exceptions

ApiError

See also

https://cloudinary.com/documentation/image_upload_api_reference#unsigned_upload_syntax

ApiResponse unsignedUpload(string $file, string $uploadPreset, array $options = [])

Uploads an asset to a Cloudinary cloud.

The upload is not signed so an upload preset is required.

Parameters

Name Type Description
$file string The asset to upload.
$uploadPreset string The name of an upload preset.
$options array The optional parameters. See the upload API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/image_upload_api_reference#unsigned_upload_syntax

__construct(mixed $configuration = null)

Admin Api constructor.

Parameters

Name Type Description
$configuration mixed

string getUploadUrl(string|null $assetType = AssetType::AUTO, string $endPoint = UploadEndPoint::UPLOAD, array $params = [])

Gets upload URL for the specified asset type and endpoint.

Parameters

Name Type Description
$assetType string|null The asset type.
$endPoint string The endpoint name.
$params array Additional query parameters.

Return Value

string

Constants

MODE_DOWNLOAD