mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-12-09 15:53:36 +00:00
fix checking upload error
This commit is contained in:
parent
b3b5d11642
commit
5567b57853
|
|
@ -136,31 +136,33 @@ if(!$file_ary) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = $file_ary[0];
|
$file = $file_ary[0];
|
||||||
if ($file['error'] == 0) {
|
/* Handle specific error 1 because it happens often */
|
||||||
if($file['error']==1) {
|
if($file['error']==1) {
|
||||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_maxsize"));
|
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_maxsize"));
|
||||||
}
|
}
|
||||||
if($file['error']!=0) {
|
/* All other errors just have a generic message */
|
||||||
|
if($file['error']!=0) {
|
||||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_failed"));
|
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_failed"));
|
||||||
}
|
}
|
||||||
if ($file["size"]==0) {
|
/* Catch uploading files without content */
|
||||||
|
if ($file["size"]==0) {
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_zerosize"));
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_zerosize"));
|
||||||
}
|
}
|
||||||
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
|
/* Check if file size is above configured max upload size */
|
||||||
if ($maxuploadsize && $file["size"] > $maxuploadsize) {
|
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
|
||||||
|
if ($maxuploadsize && $file["size"] > $maxuploadsize) {
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_maxsize"));
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_maxsize"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$userfiletmp = $file["tmp_name"];
|
$userfiletmp = $file["tmp_name"];
|
||||||
$userfiletype = $file["type"];
|
$userfiletype = $file["type"];
|
||||||
$userfilename = $file["name"];
|
$userfilename = $file["name"];
|
||||||
|
|
||||||
if($settings->_overrideMimeType) {
|
if($settings->_overrideMimeType) {
|
||||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||||
$tmpfiletype = finfo_file($finfo, $userfiletmp);
|
$tmpfiletype = finfo_file($finfo, $userfiletmp);
|
||||||
if($tmpfiletype != 'application/octet-stream')
|
if($tmpfiletype != 'application/octet-stream')
|
||||||
$userfiletype = $tmpfiletype;
|
$userfiletype = $tmpfiletype;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the uploaded file is identical to last version */
|
/* Check if the uploaded file is identical to last version */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user