imagekit-developer / imagekit-uppy-plugin

Uppy plugin for ImageKit destination
MIT License
4 stars 8 forks source link

Upload folder path #4

Closed mlanders closed 3 years ago

mlanders commented 3 years ago

Is there any way to set the folder path from the code rather than from the UI? Or set a base folder path?

I tried doing a render function on the uppy dashboard with no luck.

imagekitio commented 3 years ago

These values are ultimately using metadata fields in Uppy. Uppy allows you to set default metadata field.

As per Uppy documentation - https://uppy.io/docs/dashboard/#metaFields

Note that this metadata will only be set on a file object if it is entered by the user. If the user doesn’t edit a file’s metadata, it will not have default values; instead, everything will be undefined. If you want to set a certain meta field to each file regardless of user actions, set meta in the Uppy constructor options.

Refer to https://uppy.io/docs/uppy/#meta

This global metadata is added to each file in Uppy. It can be modified by two methods:

uppy.setMeta({ username: 'Peter' }) — set or update meta for all files.
uppy.setFileMeta('myfileID', { resize: 1500 }) — set or update meta for specific file.
Metadata from each file is then attached to uploads in Tus and XHRUpload plugins.

Metadata can also be added from a <form> element on your page, through the Form plugin or through the UI if you are using Dashboard with the metaFields option.
mlanders commented 3 years ago

Thanks. That solved my problem. Guess I overlooked the docs.