Upload Problem(prevent a new copy of an existing file)

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
hilal
Active Member II

Upload Problem(prevent a new copy of an existing file)

Hi all,

I m using Alfresco Community 5.2. I have some problems about uploading same named documents.

For example, I have a document called "test.doc". If a file with the same name is uploaded into the same area, Alfresco created another file "test-1.doc" by default. 

Could give an error message instead (like - document already exist -)? Is this possible?

Please help me..

Thanks in advance Smiley Happy

2 Replies
afaust
Master

Re: Upload Problem(prevent a new copy of an existing file)

That is quite a detail of the default Share user interface, and it is not something that provides a simple configuration to switch. There is also some logic involved to determine if the name should be adapted or not. To prevent the renaming you'd have to make sure that the "showConfig.updateFilename" setting is never set to "true". Since the showConfig is usually provided from the code to trigger the upload, you might have to check/change in multiple sources (including 3rd-party addons that might provide a custom upload action/UI) to check that every instance is configured to your preference.

Alternatively, you'd have to override the default upload web script to eliminate the code that handles the rename.

hilal
Active Member II

Re: Upload Problem(prevent a new copy of an existing file)

Hi, thanks for your answer.

I changed scope.showConfig.updateFilename as false in dnd-upload.js file. But nothing changed in my documents. I m giving my added line on code in dnd-upload.js file. How can I do ?

....

...

...

var fileName = file.name,
   updateNameAndMimetype = false;
scope.showConfig.updateFilename = false;  //I added this line
if (!!scope.showConfig.newVersion && scope.showConfig.updateFilename && scope.showConfig.updateFilename !== fileName)
{
   updateNameAndMimetype = true;
}

...

...

...