Skip to content

How to add file name when calling uploadFileGroup? #474

@NafisRubio

Description

@NafisRubio

Question

When uploading an array of images by url, how to add custom metadata do each image, like file name, tags, labels?

import {uploadFileGroup} from '@uploadcare/upload-client'

const urls = [
  'https://example.com/903948384271/image.png',
  'https://example.com/903948384282/image.png',
  'https://example.com/903948384293/image.png',
  'https://example.com/903948384302/image.png',
  'https://example.com/903948384313/image.png',
]

const {files} = await uploadFileGroup(urls, {
  publicKey: 'uploadCarePublicKey',
  store: 'auto',
  checkForUrlDuplicates: true,
  secureSignature: 'secureSignature',
  secureExpire: 'secureExpire',
  maxConcurrentRequests: 10,
  saveUrlForRecurrentUploads: true
})
// RESULT
files = [
  {
    mimeType: 'image/jpeg',
    name: 'image.png',
    originalFilename: 'image.png',
  },
  {
    mimeType: 'image/jpeg',
    name: 'image.png',
    originalFilename: 'image.png',
  },
  {
    mimeType: 'image/jpeg',
    name: 'image.png',
    originalFilename: 'image.png',
  },
  {
    mimeType: 'image/jpeg',
    name: 'image.png',
    originalFilename: 'image.png',
  },
  {
    mimeType: 'image/jpeg',
    name: 'image.png',
    originalFilename: 'image.png',
  },
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions