Commit b49ce256543fa6647a17757eec1a098a5bda8f1f

Authored by bshuttle
1 parent 1f8833ef

adding last stage of the existance checking.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4987 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktcore/folder/addDocument.php
... ... @@ -90,7 +90,18 @@ class KTFolderAddDocumentAction extends KTFolderAction {
90 90  
91 91 $aFile = $this->oValidator->validateFile($_FILES['file'], $aErrorOptions);
92 92 $sTitle = $this->oValidator->validateString($_REQUEST['title'], $aErrorOptions);
93   -
  93 +
  94 + $iFolderId = $this->oFolder->getId();
  95 + if (Document::fileExists(basename($aFile['name']), $iFolderId)) {
  96 + $this->errorRedirectToMain(_('There is already a file with that filename in this folder.'), sprintf('fFolderId=%d', $this->oFolder->getId()));
  97 + exit(0);
  98 + }
  99 +
  100 + if (Document::nameExists($sTitle, $iFolderId)) {
  101 + $this->errorRedirectToMain(_('There is already a file with that title in this folder.'), sprintf('fFolderId=%d', $this->oFolder->getId()));
  102 + exit(0);
  103 + }
  104 +
94 105 $matches = array();
95 106 $aFields = array();
96 107 foreach ($_REQUEST as $k => $v) {
... ...