mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
obey maxUploadSize whenever a file is uploaded
This commit is contained in:
parent
42633ce72f
commit
39a3e0dea3
|
@ -2,6 +2,7 @@
|
|||
Changes in version 5.1.17
|
||||
--------------------------------------------------------------------------------
|
||||
- new version 5.16.2 of fine uploader
|
||||
- obey max_upload_size whenever a file is uploaded
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.16
|
||||
|
|
|
@ -134,8 +134,8 @@ class UI extends UI_Default {
|
|||
$view->setParam('dropfolderdir', $settings->_dropFolderDir);
|
||||
$view->setParam('enablesessionlist', $settings->_enableSessionList);
|
||||
$view->setParam('workflowmode', $settings->_workflowMode);
|
||||
$view->setParam('partitionsize', (int) $settings->_partitionSize);
|
||||
$view->setParam('maxuploadsize', (int) $settings->_maxUploadSize);
|
||||
$view->setParam('partitionsize', SeedDMS_Core_File::parse_filesize( $settings->_partitionSize));
|
||||
$view->setParam('maxuploadsize', SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize));
|
||||
$view->setParam('showmissingtranslations', $settings->_showMissingTranslations);
|
||||
$view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod);
|
||||
$view->setParam('cachedir', $settings->_cacheDir);
|
||||
|
|
|
@ -331,10 +331,14 @@ if(!empty($_POST['notification_groups'])) {
|
|||
}
|
||||
|
||||
/* Check files for Errors first */
|
||||
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
|
||||
for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
||||
if ($_FILES["userfile"]["size"][$file_num]==0) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_zerosize"));
|
||||
}
|
||||
if ($maxuploadsize && $_FILES["userfile"]["size"][$file_num] > $maxuploadsize) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_maxsize"));
|
||||
}
|
||||
if (/* is_uploaded_file($_FILES["userfile"]["tmp_name"][$file_num]) && */$_FILES['userfile']['error'][$file_num]!=0){
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_failed"));
|
||||
}
|
||||
|
|
|
@ -62,10 +62,14 @@ if(isset($_POST[$prefix.'-fine-uploader-uuids']) && $_POST[$prefix.'-fine-upload
|
|||
}
|
||||
}
|
||||
|
||||
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
|
||||
for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
||||
if ($_FILES["userfile"]["size"][$file_num]==0) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_zerosize"));
|
||||
}
|
||||
if ($maxuploadsize && $_FILES["userfile"]["size"][$file_num] > $maxuploadsize) {
|
||||
UI::exitError(getMLText("folder_title", array("documentname" => $document->getName())),getMLText("uploading_maxsize"));
|
||||
}
|
||||
if (is_uploaded_file($_FILES["userfile"]["tmp_name"][$file_num]) && $_FILES['userfile']['error'][$file_num] != 0){
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_failed"));
|
||||
}
|
||||
|
|
|
@ -91,6 +91,11 @@ if (isset($_FILES['userfile']) && $_FILES['userfile']['error'] == 0) {
|
|||
if($_FILES["userfile"]["size"] == 0)
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_zerosize"));
|
||||
|
||||
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
|
||||
if ($maxuploadsize && $_FILES["userfile"]["size"] > $maxuploadsize) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_maxsize"));
|
||||
}
|
||||
|
||||
$userfiletmp = $_FILES["userfile"]["tmp_name"];
|
||||
$userfiletype = $_FILES["userfile"]["type"];
|
||||
$userfilename = $_FILES["userfile"]["name"];
|
||||
|
|
|
@ -68,7 +68,6 @@ if($view) {
|
|||
$view->setParam('presetexpiration', $settings->_presetExpirationDate);
|
||||
$view->setParam('sortusersinlist', $settings->_sortUsersInList);
|
||||
$view->setParam('defaultposition', $settings->_defaultDocPosition);
|
||||
$view->setParam('maxuploadsize', $settings->_maxUploadSize);
|
||||
$view->setParam('orderby', $settings->_sortFoldersDefault);
|
||||
$view($_GET);
|
||||
exit;
|
||||
|
|
|
@ -150,6 +150,7 @@ $(document).ready(function() {
|
|||
$folder = $this->params['folder'];
|
||||
$enablelargefileupload = $this->params['enablelargefileupload'];
|
||||
$enablemultiupload = $this->params['enablemultiupload'];
|
||||
$maxuploadsize = $this->params['maxuploadsize'];
|
||||
$enableadminrevapp = $this->params['enableadminrevapp'];
|
||||
$enableownerrevapp = $this->params['enableownerrevapp'];
|
||||
$enableselfrevapp = $this->params['enableselfrevapp'];
|
||||
|
@ -174,7 +175,11 @@ $(document).ready(function() {
|
|||
$this->contentStart();
|
||||
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
|
||||
|
||||
$msg = getMLText("max_upload_size").": ".ini_get( "upload_max_filesize");
|
||||
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
|
||||
if($maxuploadsize && $maxuploadsize < $mus2)
|
||||
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
|
||||
else
|
||||
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($mus2);
|
||||
$this->warningMsg($msg);
|
||||
$this->contentHeading(getMLText("add_document"));
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ $(document).ready( function() {
|
|||
$document = $this->params['document'];
|
||||
$strictformcheck = $this->params['strictformcheck'];
|
||||
$enablelargefileupload = $this->params['enablelargefileupload'];
|
||||
$maxuploadsize = $this->params['maxuploadsize'];
|
||||
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/validate/jquery.validate.js"></script>'."\n", 'js');
|
||||
if($enablelargefileupload) {
|
||||
|
@ -139,16 +140,13 @@ $(document).ready( function() {
|
|||
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
|
||||
|
||||
$this->contentHeading(getMLText("linked_files"));
|
||||
?>
|
||||
<div class="alert alert-warning">
|
||||
<?php echo getMLText("max_upload_size").": ".ini_get( "upload_max_filesize"); ?>
|
||||
<?php
|
||||
if(0 && $enablelargefileupload) {
|
||||
printf('<p>'.getMLText('link_alt_updatedocument').'</p>', "out.AddFile2.php?documentid=".$document->getId());
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
|
||||
if($maxuploadsize && $maxuploadsize < $mus2)
|
||||
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
|
||||
else
|
||||
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($mus2);
|
||||
$this->warningMsg($msg);
|
||||
|
||||
$this->contentContainerStart();
|
||||
?>
|
||||
|
||||
|
|
|
@ -209,6 +209,12 @@ console.log(element);
|
|||
} else {
|
||||
$msg = getMLText("max_upload_size").": ".ini_get( "upload_max_filesize");
|
||||
}
|
||||
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
|
||||
if($maxuploadsize && $maxuploadsize < $mus2)
|
||||
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
|
||||
else
|
||||
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($mus2);
|
||||
|
||||
if(0 && $enablelargefileupload) {
|
||||
$msg .= "<p>".sprintf(getMLText('link_alt_updatedocument'), "out.AddMultiDocument.php?folderid=".$folder->getID()."&showtree=".showtree())."</p>";
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
|
|||
$expandFolderTree = $this->params['expandFolderTree'];
|
||||
$enableDropUpload = $this->params['enableDropUpload'];
|
||||
$maxItemsPerPage = $this->params['maxItemsPerPage'];
|
||||
$maxuploadsize = $this->params['maxuploadsize'];
|
||||
$showtree = $this->params['showtree'];
|
||||
$onepage = $this->params['onepage'];
|
||||
$sitename = trim(strip_tags($this->params['sitename']));
|
||||
|
@ -214,7 +215,11 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
echo "SeedDMSUpload.setUrl('../op/op.Ajax.php');";
|
||||
echo "SeedDMSUpload.setAbortBtnLabel('".getMLText("cancel")."');";
|
||||
echo "SeedDMSUpload.setEditBtnLabel('".getMLText("edit_document_props")."');";
|
||||
echo "SeedDMSUpload.setMaxFileSize(".SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize")).");";
|
||||
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
|
||||
if($maxuploadsize && $maxuploadsize < $mus2)
|
||||
echo "SeedDMSUpload.setMaxFileSize($maxuploadsize);";
|
||||
else
|
||||
echo "SeedDMSUpload.setMaxFileSize($mus2);";
|
||||
echo "SeedDMSUpload.setMaxFileSizeMsg('".getMLText("uploading_maxsize")."');";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user