Add metadata to the file uploaded via context upload UIelement
Can we force the usage of the template associated with the folder during file upload using UIElement ?
Usecase:
We want to expose box UIelement ContentUpload to the user to upload file to a specific folder. We want to force the association metadata with the file being uploaded say. We want to be able to provide this information along with the file being uploaded from our app. We are planning to use the app user to do the actual upload and not Managed user
{
fileType:"Tax",
countryOfOrigin:"US"
uploadedBy:"johnSmith@acme.com"
name:"AcmeUSTaxExemption.pdf"
}
-
Hi Chiths
There is nothing natively in the content uploader element that allows you to do this but there is a way of using the event listeners to achieve what you need. There is a complete listener that will fire when all uploads are complete, you can then iterate over the files and apply metadata to each one
Something like this:
contentUploader.addListener('complete', function(files) {files.forEach(function(f) {//f.id gives the ID of the uploaded file and you can use our API to apply metadata to the file
// https://developer.box.com/reference/post-files-id-metadata-id-id/ for reference}});Best regards, Peter Christensen, Platform Solutions Engineer, Box
Please sign in to leave a comment.
Comments
1 comment