Skip to content

Commit 9a9ad85

Browse files
authored
Change the error scope.
1 parent c287c3b commit 9a9ad85

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/FilesUploadAndImageResize.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ public function uploadFiles(string $fileParamName, int $minImgWidth = 400, array
182182
}
183183
$filePath = trim($srcPath . $fileName);
184184
if (in_array(strtolower($fileInfo), array_map('strtolower', $this->allowExtension)) || empty($this->allowExtension)) {
185-
// Upload and compress only images
186-
if (strtolower($fileInfo) == 'gif' || strtolower($fileInfo) == 'jpeg' || strtolower($fileInfo) == 'jpg' || strtolower($fileInfo) == 'png') {
187-
if (isset($_FILES[$fileParamName]['error'][$this->n]) && $_FILES[$fileParamName]['error'][$this->n] > 0) {
188-
$this->param['not_uploaded_files'][] = $fileName; //All not move files name into the destination folder [ Note: Check Folder Permission ]
189-
$this->param['not_uploaded_files_error'][] = $this->phpFileUploadErrors[$_FILES[$fileParamName]['error']]; //All not move files name into the destination folder with error [ Note: Check Folder Permission ]
190-
} else {
185+
if (isset($_FILES[$fileParamName]['error'][$this->n]) && $_FILES[$fileParamName]['error'][$this->n] > 0) {
186+
$this->param['not_uploaded_files'][] = $fileName; //All not move files name into the destination folder [ Note: Check Folder Permission ]
187+
$this->param['not_uploaded_files_error'][] = $this->phpFileUploadErrors[$_FILES[$fileParamName]['error'][$this->n]]; //All not move files name into the destination folder with error [ Note: Check Folder Permission ]
188+
} else {
189+
// Upload and compress only images
190+
if (strtolower($fileInfo) == 'gif' || strtolower($fileInfo) == 'jpeg' || strtolower($fileInfo) == 'jpg' || strtolower($fileInfo) == 'png') {
191191
if ($this->compressImage($_FILES[$fileParamName]['tmp_name'][$this->n], $filePath, $minImgWidth, $waterMark, $quality, $newWidth)) {
192192
if (isset($thumbWidth) && !empty($thumbWidth)) {
193193
foreach ($thumbWidth as $tw) {
@@ -204,15 +204,15 @@ public function uploadFiles(string $fileParamName, int $minImgWidth = 400, array
204204
} else {
205205
$this->param['not_uploaded_files'][] = $fileName; //All not move files name into the destination folder [ Note: Check Folder Permission ]
206206
}
207-
}
208-
} else {
209-
// Upload all other files
210-
if (move_uploaded_file($_FILES[$fileParamName]['tmp_name'][$this->n], $filePath)) {
211-
$this->param['real_uploaded_files'][] = $val; //All uploaded files with real name
212-
$this->param['uploaded_files'][] = $fileName; //All uploaded files name are move in this array
213-
$this->param['path_uploaded_files'][] = $srcPath; //All uploaded files name are move in this array
214207
} else {
215-
$this->param['not_uploaded_files'][] = $fileName; //All not move files name into the destination folder [ Note: Check Folder Permission ]
208+
// Upload all other files
209+
if (move_uploaded_file($_FILES[$fileParamName]['tmp_name'][$this->n], $filePath)) {
210+
$this->param['real_uploaded_files'][] = $val; //All uploaded files with real name
211+
$this->param['uploaded_files'][] = $fileName; //All uploaded files name are move in this array
212+
$this->param['path_uploaded_files'][] = $srcPath; //All uploaded files name are move in this array
213+
} else {
214+
$this->param['not_uploaded_files'][] = $fileName; //All not move files name into the destination folder [ Note: Check Folder Permission ]
215+
}
216216
}
217217
}
218218
} else {

0 commit comments

Comments
 (0)