|
@@ -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;
|