I’m using Uppy dashboard and transloadit to upload files to Amazon S3. I want to have users, before clicking upload in the dashboard, hit “edit” on their dragged files, set the metadata, and have that be present in both the files themselves (such as in IPTC metadata, is this possible?) and the assembly result JSON.
In terms of code, I can set metaFields
, grabbing what the user sets:
.use(Uppy.Dashboard, {
inline: true,
target: '.DashboardContainer',
replaceTargetContent: true,
showProgressDetails: true,
showLinkToFileUploadResult: false,
height: 300,
width: 900,
note: 'Uploaded images will be renamed and resized',
metaFields: [
{ id: 'name', name: 'Name', placeholder: 'Enter the file name.' },
{ id: 'caption', name: 'Caption', placeholder: 'Describe what the image is about.' }
],
proudlyDisplayPoweredByUppy: true,
disableThumbnailGenerator: false,
browserBackButtonClose: true
})
… and I can set generic metadata on Uppy.Core
:
const uppy = Uppy.Core({
debug: true,
autoProceed: false,
allowMultipleUploads: true,
restrictions: {
maxFileSize: null,
maxNumberOfFiles: null,
minNumberOfFiles: null,
allowedFileTypes: null
},
meta: {
username: 'Bill Stewart'
}
})
I understand that I need to add the /meta/write
robot to my Transloadit template, and fill out the data_to_write
object there. My question is, how do I change my Uppy.Transloadit
plugin code, to access the above values? What I have now:
.use(Uppy.Transloadit, {
params: {
auth: {
// To avoid tampering use signatures:
// https://transloadit.com/docs/api/#authentication
key: '123456789abcdefg12345d9a4689d142'
},
template_id: 'zyx32190eb1234569d1215876543aff5',
fields: {
year: (new Date()).getFullYear()
}
},
waitForEncoding: true
})
In my template, I’m accessing the above “year” field as ${fields.year}
, but I got stuck when trying to access the values from the uppy.dashboard
and uppy.core
.
I really appreciate any help, thank you.