Is there a way to add custom meta data back to entry after the upload?
import { UploadClient } from '@uploadcare/upload-client'
const client = new UploadClient({ publicKey: "publicKey" })
const Uploadcare = (entries, onViewError) => {
const uploadEntry = makeEntryUploader(onViewError)
entries.forEach(uploadEntry)
}
const makeEntryUploader = (onViewError) => async (entry) => {
const onProgress = ({ isComputable, value }) => {
if (isComputable) {
let percent = Math.round(value * 100)
if (percent < 100) { entry.progress(percent) }
}
}
const abortController = new AbortController()
onViewError(() => abortController.abort())
const result = await client.uploadFile(entry.file, {
onProgress,
signal: abortController.signal,
})
// How to add the data to the entry?
entry.meta = {
...entry.meta,
// This doesn't work:
uploadcare: result
}
entry.progress(100)
}
const uploaders = {
Uploadcare,
}
export default uploaders
I have this in the live view:
defp presign_upload(entry, socket) do
meta = %{uploader: "Uploadcare"}
{:ok, meta, socket}
end
But I only get the url and stuff in the response from the await client.uploadFile(entry.file, {
Has anyone ran into this? Do I need move the uploading to the server side to get the required data?