SHA-1698 - Enhancement to V0 Upload API to support creation of folder path during upload process. Added to Script API and Test suite.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@130934 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2016-09-27 13:46:47 +00:00
parent 515576e734
commit ea88ad99af

View File

@@ -16,6 +16,7 @@ function exitUpload(statusCode, statusMsg)
status.message = statusMsg;
status.redirect = true;
}
/**
* Creates an new filename by adding a suffix to existing one in order to avoid duplicates in folder
* The check that folder already contains the filename should be done before calling this function
@@ -69,6 +70,7 @@ function main()
// Upload specific
var uploadDirectory = null,
createDirectory = false,
contentType = null,
aspects = [],
overwrite = true; // If a filename clashes for a versionable file
@@ -173,6 +175,10 @@ function main()
case "updatenameandmimetype":
updateNameAndMimetype = field.value == "true";
break;
case "createdirectory":
createDirectory = field.value == "true";
break;
}
}
@@ -335,10 +341,17 @@ function main()
{
var child = destNode.childByNamePath(uploadDirectory);
if (child === null)
{
if (createDirectory)
{
child = destNode.createFolderPath(uploadDirectory);
}
else
{
exitUpload(404, "Cannot upload file since upload directory '" + uploadDirectory + "' does not exist.");
return;
}
}
// MNT-12565
while (child.isDocument)