AnsweredAssumed Answered

Plugin for upload with metadata

Question asked by softwareloop on Oct 24, 2014
Latest reply on Nov 5, 2014 by softwareloop
Hi, I'm started working on a new plugin which basically is a file uploader that prompts for metadata. I thought I'd share my design and have your feedback. I also have a specific question - I'll ask at the end of this message.

The idea is to replace Share's standard uploader with a similar component that:
- allows to upload one or more documents
- asks for the document type (for each file, from a list of standard and custom types)
- prompts for metadata (for each file, based on the document type)

Just to be sure I'm not reinventing the wheel, I've searched for existing add-ons and found a commercial one that does something similar:
https://addons.alfresco.com/addons/edit-meta-data-during-upload
… but it seems to consider only standard metadata (title, description, author, etc) with no option for custom types and properties.

There are couple of open source ones too:
https://addons.alfresco.com/addons/content-uploader-pro
https://addons.alfresco.com/addons/upload-tag
… but these seem to be related more to categories and tagging than to metadata.

This post in the forum is interesting for a discussion of the problems and an outline of possible solutions
https://forums.alfresco.com/forum/developer-discussions/alfresco-share-development/edit-metadata-upon-upload-08142013-1955

So what do you think?

As I mentioned at the beginning I have a specific question.
An important requirement for my plugin is that the three operations (uploading, giving a type and setting metadata) be atomic from the repository's perspective. So when an uploaded document appears in the destination folder it is already typed and has all the metadata. This is in contrast to a solution that uploads first and adds metadata later as a separate step.
The rationale is that in a real ECMS there is so much automation on folders (content rules, behaviours, etc) that when a doc enters the system it must have the type and properties in place from the beginning.

So the question is: how would approach this?
The core upload webscript /alfresco/api/upload takes contentType as a parameter but doesn't handle metadata, correct? To handle metadata I could:
- enhance the core upload webscript
- first upload the document to a temporary folder, then apply the metadata as an update, finally move the document to its destination folder

I'd like to understand the pros and cons or if there are other approaches.

Thank you.

Paolo

Outcomes