dever 6 years ago
parent
commit
33d163d7bf
2 changed files with 6 additions and 2 deletions
  1. 5 2
      lib/Store/Core.php
  2. 1 0
      lib/Store/Qiniu.php

+ 5 - 2
lib/Store/Core.php

@@ -200,7 +200,6 @@ class Core
 		        $this->base64 = true;
 			} else {
 				$name = urldecode($this->data['file']);
-				$file = $name;
 			}
 
 			$this->data['file'] = array();
@@ -210,6 +209,7 @@ class Core
 				header('Content-type: text/json; charset=utf-8');
 				$path = Dever::path($this->base, 'tmp/');
 				
+				$this->ext = '.' . pathinfo($name, PATHINFO_EXTENSION);
 				$this->data['file']['name'] = 'Tmp' . sha1($name);
 				$this->data['file']['tmp_name'] = $path . $this->data['file']['name'];
 
@@ -227,9 +227,12 @@ class Core
 						# 将webp图片转成jpg
 						$this->ext = '.jpg';
 					}
+					if (!isset($file)) {
+						Dever::alert('错误的文件来源');
+					}
 					file_put_contents($this->data['file']['tmp_name'], $file);
-					$this->data['file']['size'] = filesize($this->data['file']['tmp_name']);
 				}
+				$this->data['file']['size'] = filesize($this->data['file']['tmp_name']);
 			} else {
 				$this->data['file']['name'] = $name;
 				$this->data['file']['tmp_name'] = $file;

+ 1 - 0
lib/Store/Qiniu.php

@@ -39,6 +39,7 @@ class Qiniu extends Core implements Config
             $file = $this->file;
         }
 
+        echo $this->data['file']['tmp_name'];die;
         if ($this->base64) {
             list($ret, $err) = $upload->put($token, $file, $this->data['file']['tmp_name'], $param = null);
         } else {