Commit 273b48fe90ab5fc8446c83bafb3faab8aea861fe
1 parent
53742fcb
(#2838) added check for zero sized uploaded document
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2545 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
6 additions
and
5 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentBL.php
| ... | ... | @@ -37,8 +37,9 @@ if (checkSession()) { |
| 37 | 37 | if (isset($fStore)) { |
| 38 | 38 | // check that a document type has been selected |
| 39 | 39 | if ($fDocumentTypeID) { |
| 40 | - //make sure the user actually selected a file first | |
| 41 | - if (strlen($_FILES['fFile']['name']) > 0) { | |
| 40 | + // make sure the user actually selected a file first | |
| 41 | + // and that something was uploaded | |
| 42 | + if ( (strlen($_FILES['fFile']['name']) > 0) && $_FILES['fFile']['size'] > 0) { | |
| 42 | 43 | //if the user selected a file to upload |
| 43 | 44 | //create the document in the database |
| 44 | 45 | $oDocument = & PhysicalDocumentManager::createDocumentFromUploadedFile($_FILES['fFile'], $fFolderID); |
| ... | ... | @@ -126,7 +127,7 @@ if (checkSession()) { |
| 126 | 127 | $default->log->error("addDocumentBL.php DB error storing document in folder " . Folder::getFolderPath($fFolderID) . " id=$fFolderID"); |
| 127 | 128 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 128 | 129 | $oPatternCustom = & new PatternCustom(); |
| 129 | - $oPatternCustom->setHtml(getStatusPage($fFolderID, "An error occured while storing the document in the database, please try again.</td><td><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"></a>")); | |
| 130 | + $oPatternCustom->setHtml(getStatusPage($fFolderID, "An error occured while storing the document in the database, please try again.</td><td><a href=\"$default->rootUrl/control.php?action=addDocument&fFolderID=$fFolderID&fDocumentTypeID=$fDocumentTypeID\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\"></a>")); | |
| 130 | 131 | $main->setCentralPayload($oPatternCustom); |
| 131 | 132 | $main->render(); |
| 132 | 133 | } |
| ... | ... | @@ -135,7 +136,7 @@ if (checkSession()) { |
| 135 | 136 | $default->log->error("addDocumentBL.php Document exists with name " . $oDocument->getFileName() . " in folder " . Folder::getFolderPath($fFolderID) . " id=$fFolderID"); |
| 136 | 137 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 137 | 138 | $oPatternCustom = & new PatternCustom(); |
| 138 | - $oPatternCustom->setHtml(getStatusPage($fFolderID, "A document with this file name already exists in this folder</td><td><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"></a>")); | |
| 139 | + $oPatternCustom->setHtml(getStatusPage($fFolderID, "A document with this file name already exists in this folder</td><td><a href=\"$default->rootUrl/control.php?action=addDocument&fFolderID=$fFolderID&fDocumentTypeID=$fDocumentTypeID\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\"></a>")); | |
| 139 | 140 | $main->setCentralPayload($oPatternCustom); |
| 140 | 141 | $main->render(); |
| 141 | 142 | } |
| ... | ... | @@ -143,7 +144,7 @@ if (checkSession()) { |
| 143 | 144 | // no uploaded file |
| 144 | 145 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 145 | 146 | $oPatternCustom = & new PatternCustom(); |
| 146 | - $oPatternCustom->setHtml(getStatusPage($fFolderID, "You did not select a valid document to upload</td><td><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"></a>")); | |
| 147 | + $oPatternCustom->setHtml(getStatusPage($fFolderID, "You did not select a valid document to upload</td><td><a href=\"$default->rootUrl/control.php?action=addDocument&fFolderID=$fFolderID&fDocumentTypeID=$fDocumentTypeID\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\"></a>")); | |
| 147 | 148 | $main->setCentralPayload($oPatternCustom); |
| 148 | 149 | $main->render(); |
| 149 | 150 | } | ... | ... |