mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 05:50:50 +00:00
【程序目录】更新本地上传验证
This commit is contained in:
parent
6fb1f7528a
commit
3437415023
@ -125,14 +125,16 @@ class Local extends BaseUpload
|
||||
if (!in_array($fileHandle->getOriginalMime(), $this->validate['fileMime'])) {
|
||||
return $this->setError('不合法的文件类型');
|
||||
}
|
||||
$stream = fopen($fileHandle->getPathname(), 'r');
|
||||
$content = (fread($stream, filesize($fileHandle->getPathname())));
|
||||
if (is_resource($stream)) {
|
||||
fclose($stream);
|
||||
}
|
||||
$image = @imagecreatefromstring($content);
|
||||
if ($image === false) {
|
||||
return $this->setError('文件内容不合法');
|
||||
if (in_array($fileHandle->getOriginalMime(), ['image/x-icon', 'image/png', 'image/gif', 'image/jpeg', 'image/jpg'])) {
|
||||
$stream = fopen($fileHandle->getPathname(), 'r');
|
||||
$content = (fread($stream, filesize($fileHandle->getPathname())));
|
||||
if (is_resource($stream)) {
|
||||
fclose($stream);
|
||||
}
|
||||
$image = @imagecreatefromstring($content);
|
||||
if ($image === false) {
|
||||
return $this->setError('文件内容不合法');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($realName) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user