You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Model/Behavior/BlobFileBehavior.php
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,10 @@ public function isUploadedFileImage($model,$params) {
69
69
70
70
$val = array_shift($params);
71
71
72
+
if ( ! empty($val['error'])) {
73
+
return$this->errorCodeToMessage($val['error']);
74
+
}
75
+
72
76
if ( ! empty($val['name']) andempty($val['tmp_name'])) {
73
77
returnfalse;
74
78
}
@@ -83,4 +87,36 @@ public function isUploadedFileImage($model,$params) {
83
87
return$fileHandler->isImage();
84
88
}
85
89
90
+
protectedfunctionerrorCodeToMessage($code)
91
+
{
92
+
switch ($code) {
93
+
caseUPLOAD_ERR_INI_SIZE:
94
+
$message = "The uploaded file exceeds the maximum allowed upload size of ".ini_get('upload_max_filesize').'.'; // upload_max_filesize directive in php.ini
95
+
break;
96
+
caseUPLOAD_ERR_FORM_SIZE:
97
+
$message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form";
98
+
break;
99
+
caseUPLOAD_ERR_PARTIAL:
100
+
$message = "The uploaded file was only partially uploaded";
0 commit comments