Commit b49ce256543fa6647a17757eec1a098a5bda8f1f
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
Showing
1 changed file
with
12 additions
and
1 deletions
plugins/ktcore/folder/addDocument.php
| @@ -90,7 +90,18 @@ class KTFolderAddDocumentAction extends KTFolderAction { | @@ -90,7 +90,18 @@ class KTFolderAddDocumentAction extends KTFolderAction { | ||
| 90 | 90 | ||
| 91 | $aFile = $this->oValidator->validateFile($_FILES['file'], $aErrorOptions); | 91 | $aFile = $this->oValidator->validateFile($_FILES['file'], $aErrorOptions); |
| 92 | $sTitle = $this->oValidator->validateString($_REQUEST['title'], $aErrorOptions); | 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 | $matches = array(); | 105 | $matches = array(); |
| 95 | $aFields = array(); | 106 | $aFields = array(); |
| 96 | foreach ($_REQUEST as $k => $v) { | 107 | foreach ($_REQUEST as $k => $v) { |