Closed ehudmi closed 2 years ago
Hey @ehudmi,
passing metadata to the react-widget as a prop isn't implemented yet. It will be released soon.
As a workaround you can use global variables like UPLOADCARE_METADATA
or UPLOADCARE_METADATA_CALLBACK
Thanks for the response - my problem was apparently due to not formatting the metadata properly.
metadata={JSON.stringify({ userId: authState.userId, projectId: projectName, })}
this worked perfectly for me - I was importing the widget into another component and passing the values for userId and projectId dynamically from the hosting component
I do have another question though - is it possible to limit number of uploadable files using the validators? Not to let a user upload more than 3 files...
I do have another question though - is it possible to limit number of uploadable files using the validators? Not to let a user upload more than 3 files...
Yeah, it's possible using multipleMax
option. See https://uploadcare.com/docs/uploads/file-uploader-options/#option-multiple-max
Thanks for the response - my problem was apparently due to not formatting the metadata properly.
metadata={JSON.stringify({ userId: authState.userId, projectId: projectName, })}
this worked perfectly for me - I was importing the widget into another component and passing the values for userId and projectId dynamically from the hosting component
It was kinda undocumented feature. It won't work in v2.3.0
anymore. So you will need to use metadata = { {userId: authState.userId, projectId: projectName} };
as you tried before.
I do have another question though - is it possible to limit number of uploadable files using the validators? Not to let a user upload more than 3 files...
Yeah, it's possible using
multipleMax
option. See https://uploadcare.com/docs/uploads/file-uploader-options/#option-multiple-max
Great - thanks...it looks awesome...
Question
I'm trying to pass the widget metadata info to set on all files to be uploaded with the widget and I'm getting: "Option "metadata" is expected to be an object. Instead got: string " I was trying basically to pass metadata as: metadata = { {userId: authState.userId, projectId: projectName} }; within the