| xqd
@@ -18,11 +18,11 @@ class UploadService
|
|
|
private static $uploadStatus;
|
|
|
|
|
|
//上传图片的大小 2MB 单位字节
|
|
|
- private static $imageValidate = ['size' => 2097152, 'ext' => 'jpg,jpeg,png,gif', 'mime' => 'image/jpeg,image/gif,image/png'];
|
|
|
+ private static $imageValidate = ['size' => 2097152000, 'ext' => 'jpg,jpeg,png,gif', 'mime' => 'image/jpeg,image/gif,image/png'];
|
|
|
|
|
|
private static $fileExt = ['pem', 'mp3', 'wma', 'wav', 'amr', 'mp4', 'key', 'xlsx'];//上传文件后缀类型
|
|
|
|
|
|
- private static $fileMime = ['text/plain', 'audio/mpeg', 'application/x-x509-ca-cert', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; //上传文件类型
|
|
|
+ private static $fileMime = ['text/plain', 'audio/mpeg', 'video/mp4', 'application/x-x509-ca-cert', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; //上传文件类型
|
|
|
|
|
|
/**
|
|
|
* 初始化
|
| xqd
@@ -139,7 +139,7 @@ class UploadService
|
|
|
$uploaded_size = $_FILES[$fileName]['size'];
|
|
|
$extension = strtolower(pathinfo($uploaded_name, PATHINFO_EXTENSION));
|
|
|
if (strtolower($extension) === 'php' || !$extension) return self::setError('上传文件非法!');
|
|
|
- if (in_array(strtolower($uploaded_ext), self::$fileExt) && ($uploaded_size < 2097152) && in_array($uploaded_type, self::$fileMime)) {
|
|
|
+ if (in_array(strtolower($uploaded_ext), self::$fileExt) && ($uploaded_size < 2097152000) && in_array($uploaded_type, self::$fileMime)) {
|
|
|
$file = request()->file($fileName);
|
|
|
if (count($autoValidate) > 0) $file = $file->validate($autoValidate);
|
|
|
$fileInfo = $file->rule($rule)->move($dir, $moveName);
|