dever 5 years ago
parent
commit
010a8a6ef1
1 changed files with 14 additions and 12 deletions
  1. 14 12
      lib/Store/Core.php

+ 14 - 12
lib/Store/Core.php

@@ -160,20 +160,22 @@ class Core
 		# 默认30M
 		$size = $this->config['size'] > 0 ? 1024*$this->config['size'] : 30*1024*1024;
 
-		$this->size = $this->data['file']['size'];
+		if (isset($this->data['file']['size'])) {
+			$this->size = $this->data['file']['size'];
 		
-		if (($size < $this->data['file']['size']) && $size > 0) {
-			$this->output['status'] = -1;
-			$this->output['message'] = '文件不能超过'.$size.'k';
-		} elseif ($this->config['width'] > 0 && $this->config['width'] < $this->limit[0]) {
-			$this->output['status'] = -1;
-			$this->output['message'] = '图片宽度不能超过' . $this->config['width'] . 'px';
-		} elseif ($this->config['height'] > 0 && $this->config['height'] < $this->limit[1]) {
-			$this->output['status'] = -1;
-			$this->output['message'] = '图片高度不能超过' . $this->config['height'] . 'px';
-		}
+			if (($size < $this->data['file']['size']) && $size > 0) {
+				$this->output['status'] = -1;
+				$this->output['message'] = '文件不能超过'.$size.'k';
+			} elseif ($this->config['width'] > 0 && $this->config['width'] < $this->limit[0]) {
+				$this->output['status'] = -1;
+				$this->output['message'] = '图片宽度不能超过' . $this->config['width'] . 'px';
+			} elseif ($this->config['height'] > 0 && $this->config['height'] < $this->limit[1]) {
+				$this->output['status'] = -1;
+				$this->output['message'] = '图片高度不能超过' . $this->config['height'] . 'px';
+			}
 
-		$this->size = number_format($this->size/1024, 2);
+			$this->size = number_format($this->size/1024, 2);
+		}
 	}
 	
 	/**