cancel
Showing results for 
Search instead for 
Did you mean: 

file name as a key to upload

forumwebuser
Champ in-the-making
Champ in-the-making
Hello,

Can someone explain me what is the impact of the names of the files in an alfresco repository?
I created a simple workspace with a simple model. In my model I have some indexes/fields. In nowhere in this model I make a reference to the file name of the files I will upload as a field/index/key of my model .

However, if I upload for the second time a file with the same file name, even if one of the indexes is different, alfresco will throw an error saying that the file name already exists. It seems that alfresco is saving the file to a file system directory without applying a internal name to it…

I would like to be able to have documents with the same name in the same workspace, and control if the document exists only using my own indexes/fields.

Is this possible?

thank you
3 REPLIES 3

mrogers
Star Contributor
Star Contributor
Your name property (cm:name) is probably being extracted from the file that you upload.

If you are uploading to a file folder structure that uses the cm:contains association (i.e. a bog standard alfresco file/folder structure) then there is a constraint to prevent duplicate names.

You could upload with a different primary association which does not have the unique name constraint but then your node will not show up in the interfaces that work off the file / folder service.

Perhaps the easiest approach would be to upload to different folders.

openpj
Elite Collaborator
Elite Collaborator
Alfresco stores files using XPath and cm:name, if you need to write a second version of the same file you have to enable versioning for that space.

In the contentModel.xml file you can find cm:contains association and I think that you can override the duplicate setting… I'm not sure about it and I don't know if Alfresco supports this type of changes.

Hope this helps.

forumwebuser
Champ in-the-making
Champ in-the-making
First of all, thank you for your answers.

mrogers,

Im uploading to a file structure that uses my own model, but as far as I understand, I may get all the defaults from the contentmodel.xml, and that may be the reason why there is a restriction on the file name.

"You could upload with a different primary association which does not have the unique name constraint but then your node will not show up in the interfaces that work off the file / folder service."
Does this means that if I go to the alfresco web client site I will not be aqble to browse with success may file and folders?

"Perhaps the easiest approach would be to upload to different folders."
I cant do this, because the files are organized in folders related to business rules.


OpenPj,


"Alfresco stores files using XPath and cm:name, if you need to write a second version of the same file you have to enable versioning for that space."
Yes, Im already versioning files in some cases. The problem here is that accordingly to may indexes, the file actually doesnt exists! But because I will upload a file with the same name (but with different custom indexes) Alfresco will throw an error saying the file already exists.

"In the contentModel.xml file you can find cm:contains association and I think that you can override the duplicate setting… I'm not sure about it and I don't know if Alfresco supports this type of changes."

I saw it there, tanks. Can I overwrite it in my custom model? Any example? But if I overwrite it, will I still be able to browse the files in the alfresco web client web site?

In general Im searching for a way to ignore the file names of files when uploading. I want to control de existence of files only with my custom indexes/fields. At the same time I dont want to loose the possibility of brwosing the files using alfreaco web clients?

Any additional help is appreciated Smiley Happy


thank you