Commit 5d76878e8ca82205db74d114fb27ff5a33c7e4d8
1 parent
9c1412a8
Give an accurate error message when upload_max_size is exceeded.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3340 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
16 additions
and
1 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/bulkUploadBL.php
| ... | ... | @@ -66,6 +66,20 @@ if (!BulkUploadManager::isBulkUploadCapable()) { |
| 66 | 66 | exit(0); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | +$postExpected = KTUtil::arrayGet($_REQUEST, "postExpected"); | |
| 70 | +$postReceived = KTUtil::arrayGet($_REQUEST, "postReceived"); | |
| 71 | +if (!is_null($postExpected) && is_null($postReceived)) { | |
| 72 | + // A post was to be initiated by the client, but none was received. | |
| 73 | + // This means post_max_size was violated. | |
| 74 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 75 | + $oPatternCustom = & new PatternCustom(); | |
| 76 | + $errorMessage = _("You tried to upload a file that is larger than the PHP post_max_size setting."); | |
| 77 | + $oPatternCustom->setHtml("<font color=\"red\">" . $errorMessage . "</font><br /><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"></a>"); | |
| 78 | + $main->setCentralPayload($oPatternCustom); | |
| 79 | + $main->render(); | |
| 80 | + exit(0); | |
| 81 | +} | |
| 82 | + | |
| 69 | 83 | /* CHECK: folder ID passed in */ |
| 70 | 84 | if (isset($fFolderID)) { |
| 71 | 85 | $oFolder = Folder::get($fFolderID); |
| ... | ... | @@ -105,7 +119,7 @@ if (!$fDocumentTypeID) { |
| 105 | 119 | if (!$fStore) { |
| 106 | 120 | // show upload/metatdata form |
| 107 | 121 | $oPatternCustom->setHtml(getPage($fFolderID, $fDocumentTypeID)); |
| 108 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 122 | + $main->setFormAction($_SERVER["PHP_SELF"] . "?postExpected=1&fFolderID=$fFolderID"); | |
| 109 | 123 | $main->setFormEncType("multipart/form-data"); |
| 110 | 124 | $main->setHasRequiredFields(true); |
| 111 | 125 | $main->setErrorMessage($sErrorMessage); | ... | ... |
presentation/lookAndFeel/knowledgeTree/documentmanagement/bulkUploadUI.inc
| ... | ... | @@ -157,6 +157,7 @@ function getPage($iFolderID, $iDocumentTypeID) { |
| 157 | 157 | |
| 158 | 158 | $sToRender .= "<input type=\"hidden\" name=\"fDocumentTypeID\" value=\"$iDocumentTypeID\">"; |
| 159 | 159 | $sToRender .= "<input type=\"hidden\" name=\"fStore\" value=\"1\">"; |
| 160 | + $sToRender .= "<input type=\"hidden\" name=\"postReceived\" value=\"1\">"; | |
| 160 | 161 | $sToRender .= "<table>\n"; |
| 161 | 162 | $sToRender .= "<tr>\n"; |
| 162 | 163 | $sToRender .= "<td colspan=\"2\"><b>" . _("Bulk Upload Zipfile") . ": <b></td>\n"; | ... | ... |