Skip to content

Commit

Permalink
更好的兼容base64上传,支持base64上传空值
Browse files Browse the repository at this point in the history
  • Loading branch information
haohetao committed May 30, 2020
1 parent 7d6e4c0 commit 92f3707
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/UploadBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ protected function getUploadInstance($attribute)
} else if (is_array($file)) {
$files = $file;
}
if ($files) {
if (isset($files) && is_array($files)) {
foreach ($files as $one) {
if ($one && $one->hasError) {
switch ($one->error) {
Expand Down
2 changes: 1 addition & 1 deletion src/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function uploadBase64File($file, $name)
$fileParse = explode(',', $file);
$file = $fileParse[1];
} else {
throw new ErrorException('错误的base64编码');
return null;
}

$fileDecoded = base64_decode($file);
Expand Down

0 comments on commit 92f3707

Please sign in to comment.