Set the document type on file upload
In Alfresco Share you may want to set the document type already on file upload. Else there will be a 2-step process by first uploading, and then select Change Type.
This is possible, but requires a small code change. Most is already done by the Alfresco developers, so you should be able to quickly make the changes yourself.
Find the file */site-webscripts/org/alfresco/components/upload/flash-upload.get.js. It is used both for flash and html upload, so your changes will work for both ways to upload files.
In the file, extend the array with your custom types.
/**
* Custom content types
*/
function getContentTypes()
{
// TODO: Data webscript call to return list of available types
var contentTypes = [
{
id: "cm:content",
value: "cm_content"
},
{
id: "my:customtype",
value: "my_customtype"
}
];
return contentTypes;
}
model.contentTypes = getContentTypes();
The TODO is Alfresco developers note, so we may get this as an actual config option in the future, bit for now this is how you need to do it.
You also need to extend the file flash-upload.get.properties, in this case also html-upload.get.properties.
Add the value for “value” in the javascript for each of you custom types.
my_customtype=My Custom Type
This works well, and you get to set the document type for each of the files individually. There is one bug I’ve noticed, and that is that you get prompted for document type when uploading a new version, but it actually doesn’t change the type.
This is what it can look like.

2 Responses to Set the document type on file upload
Twitter
- RT @mjasay: Microsoft's masochistic licensing fixation: caught in The Innovator's Dilemma http://t.co/fJOeAuPh
- RT @jeffpotts01: Quick-and-dirty file management web app built with #Pyramid, #cmis, #alfresco http://t.co/nwX02WiE
- Use a specific metadata edit form in Alfresco Share if document has aspect applied http://t.co/m3oFXtug
English
Svenska 





Great Post! I’m currently setting the document type upon upload, but my next step is to figure out how to allow users to set common metadata immediately after upload but before they hit “OK”. Any ideas? If so, email me.
Thanks!
Julie
I’m trying to figure out the same as Julie, so if you have any clue it would make a great blog post.
Thanks, great post.